请教高手:一个奇怪而有趣的问题,高分相送!
调用动态库里的函数,向其传递指针参数,程序运行异常出错。
相关代码如下:
程序:char buffer[7][16];
int Write=Writedata(buffer[0],bufferlenth);
动态库:
int WINAPI Writedata(char *buffer,int listsize);
我已将Writedata()函数体置空,返回0;试过静态,动态连接;单部调试buffer的地址 ,内容都正常存在和正常。
但程序运行至int Write=Writedata(buffer,bufferlenth);(buffer里的数据没有越界),任然报错:
Debug Error!
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declard with one calling convention with a function pointer declared with a different calling convention.
显然是在传递参数时出错。
我实在找不出原因所在,还请哪位高手指点。