在dll中定义
int DllExport test ()
{
MessageBox(NULL,"OneStopFactory is called.","Leadtone",MB_OK);
return 0;
}调用时
HINSTANCE hModule;
typedef int (Dllfun)();
FARPROC hFunction ; hModule = ::LoadLibrary("dllhost.dll");
hFunction = ::GetProcAddress((HMODULE)hModule,"test");
(*hFunction)();
hfunction 总得不到test()的地址。另外,我在使用dumpbin.exe来得到某个DLL中所输出的符号的清单,时出现了这样的问题:出现了对话框“link.exe -无法找到DLL。”
int DllExport test ()
{
MessageBox(NULL,"OneStopFactory is called.","Leadtone",MB_OK);
return 0;
}调用时
HINSTANCE hModule;
typedef int (Dllfun)();
FARPROC hFunction ; hModule = ::LoadLibrary("dllhost.dll");
hFunction = ::GetProcAddress((HMODULE)hModule,"test");
(*hFunction)();
hfunction 总得不到test()的地址。另外,我在使用dumpbin.exe来得到某个DLL中所输出的符号的清单,时出现了这样的问题:出现了对话框“link.exe -无法找到DLL。”
解决方案 »
- CAsyncSocket::Send函数发送字符缺失
- 求助!!!如何编程更改一个文件的图标???
- 帮帮小妹啊!我是新手刚刚开始学oracle!!我要用oracle为车牌识别系统建立一个数据库~~不知道怎么建表,请各位给点意见。万分感激~~
- vc 使用自动化操作EXCEL的高手快请进,急!
- 基于SDI的程序,最后一步视的基类是CScrollView,这个视里显示得是一个图形.解决如何让它自动滚动.
- 标题栏问题!!!
- PICTURE控件插入图片后,拖动边框,图片不能随边框大小变化,怎么办呢?
- 在编译一个动态连接库出现一个错误
- 有关内存泄露得问题,最终解决再加200分,感谢各位高手得鼎立指教!!
- RemoteData 和DBGrid 控 件的提问
- 如何向别的程序发消息?
- 单击窗口任意位置都可拖动窗口,怎样实现?
typedef int (*DLLFUN)();
DLLFUN Dllfun;
hModule = LoadLibrary("dllhost.dll");
Dllfun =(DLLFUN)GetProcAddress(hModule,"test");
Dllfun();
//试试
extern "C" int DllExport test()
{
MessageBox(NULL,"OneStopFactory is called.","Leadtone",MB_OK);
return 0;
}
要注意__stdcall和_ccall.你是在def文件输出函数吗?
是的话,just like this:
typedef int (__stdcall *dllfun)();
将绝对路径写上试一试,看hModual对不对
#else
#define DllExport __declspec(dllimport)
#endif然后定义def文件~
extern "C" _declspec(dllexport) int test()
HINSTANCE hModule;
typedef int (Dllfun)();-> 定义错误,typedef int (*DLLFUN)();
FARPROC hFunction ; hModule = ::LoadLibrary("dllhost.dll");
hFunction = ::GetProcAddress((HMODULE)hModule,"test");
//Dllfun=(DLLFUN)xxxxxx (*hFunction)();
//(*Dllfun)();
hfunction 总得不到test()的地址。