求大家帮帮我:vc掉dll的问题
extern "C" int PASCAL EXPORT loadadd(int x,int y,int z) //在vb中调用
{
typedef int ( * lpFunc)(int ,int ,int );
HINSTANCE hLibrary;
lpFunc Func;
int temp;
hLibrary = LoadLibrary("add.dll"); // Load the DLL now
if (hLibrary != NULL)
{
Func = (lpFunc) GetProcAddress(hLibrary, "add"); //得到add函数的地址
if (Func != NULL)
{
temp=Func(x,y,z);
}
}
return temp; //返回给vb显示
FreeLibrary(hLibrary); // Unload DLL from memory
}
这是我的一个test1.dll,要被vb调用,还要调用add.dll。即数要从vb传到test1再到add,运算后传回test1再到vb.现在的问题是:数传回时vb提示说有错,debug error.调试看是temp=Func(x,y,z);过不去了,若忽略,可以看到temp=返回值,但到不了vb.请问:temp=Func()是不是用的不对?能不能换一种方法?(vb那边没用问题)不胜感激!!