求解:提示DLL调用约定错误
int w;
int h;
unsigned char *ByteBuffer1;
unsigned char *ByteBuffer2;
len=ProcessBuf(ByteBuffer1,ByteBuffer2,w,h);
C++中没问题
-----------------------
如在VB中调用此DLL
Declare Function ProcessBuf Lib "Test.DLL " (ByteBuffer1 as any,ByteBuffer2 as any,byval w as long,byval h as long) as long
dim buf1(1000) as byte,buf2(1000) as byte
dim w as long,h as long
dim rlen as long
...
..
rlen=ProcessBuf(buf1(0),buf2(0),w,h)
提示DLL调用约定错误!
rlen=ProcessBuf(varptr(buf1(0)),varptr(buf2(0)),w,h)
一样!
是哪里出了错??
[解决办法]
如果你有 ProcessBuf 函数所在的DLL文件的源码的话,导出这个函数的时候指定 __stdcall 调用约定,如果没有源码,就用C/C++再包一层,比如
__stdcall long CallProcessBuf( ... ) {
return( ProcessBuf( ... ) );
}
[解决办法]
ByteBuffer1 as any ==> byval ByteBuffer1 as string
ByteBuffer2 as any ==> byval ByteBuffer2 as string