估计不是路径放的问题,加载的时候加载不到不知为啥
方便的话 把dll发给我
追问#include
__declspec(dllexport) int add_one(int i)
{
return i+1;
}
就这么简单的一句
extern "C" __declspec(dllexport) int add_one(int i);
这样定义
哎,我起名直接用的test.c 加上extern 也不行 不弄了 谢谢哈
本回答被提问者和网友采纳unused CXX0030: Error: expression cannot be evaluated
调试出这个错误 ,LibHandle这个变量 还是获得不了,需要添加什么依赖项什么的么
一、你的test.dll文件在哪里,你要把LoadLibrary()括号中写上完整的路径名
LibHandle=LoadLibrary(".\\test.dll" ); //你这样写一下试试
二、LibHandle=LoadLibrary( XXX ) ;//之后,加个判断:
if ( LibHandle== NULL )
{
printf("load library error\n"); //如果出现这句,说明你的动态库文件名XXX那里写的不对!或dll库有问题
return ;
}
三、在add_one=(hand)GetProcAddress( LibHandle, ZZZ );之后,也加一句
if ( add_one== NULL )
{
printf("get function error\n"); //如果出现这句,说明你的ZZZ函数名写错了 !
return ;
}