【发布时间】:2013-02-23 14:46:00
【问题描述】:
我有问题。我的 dll 中有一个函数,定义如下:
int function(char *inVal, char *outVal, int *retVal)
我使用 LoadLibrary 在控制台应用程序中成功加载了我的 dll,并使用函数指针调用了我的函数:
typedef int (__cdecl *functionPtr)(char *, char *,int *);
然后我将我的 inVal 传递给我的函数:
char * inVal = "input";
现在我想获得我的 outVal 和 retVal,我已经成功获得了 retVal 但我的 outVal 为 NULL:
int retVal = 0;
char outVal[200] = {0};
然后我调用我的函数:
int return = functionLNK(inVal , outVal, &retVal)
有什么线索吗?!!
编辑 1:
代码如下:
int function(char *inVal, char *outVal, int *retVal)
{
PKI_Buf inBuf, signBuf, pemBuf;
......
outVal = (char*)pemBuf.data;
//I check outVal in this point and it is not NULL
}
【问题讨论】:
-
我检查了我的 dll 中的日志,我的 dll 中的 outVal 不是 NULL
-
你的意思是
char outVal[200] = {0};? -
DLL中的函数呢?您确定它正确更改了该缓冲区的内容吗?
-
@Amir:你能把DLL中函数的代码显示一下吗?
-
@AndyProwl 现在已经确认了。通灵很棒。
标签: c++ dll char loadlibrary