动态库中的函数如下形式:
int func( unsigned char *desc, int *destlen, const unsigned char*source, int sourclen)
我在vb中声明动态库参数形式为
Private Declare Function func Lib "mylib.dll" (desc As Byte, desclen As Long, source As Byte, ByVal sourcelen As Long)
使用时,
dim dStr() as byte
dim sStr() as byte
...
rs = func(dStr(0), dLen, sStr(0), slen)
这样使用时告诉我动态库调用约定错误,如何修改,请指教。

解决方案 »

  1.   

    desc As Byte,
     desclen As Long,
     source As Byte看看这几个是否为Byref传参的?如果不是前面加Byval
      

  2.   

    是你申明的VB类型与C++里的类型不对应造成的,改用其它类型试试
      

  3.   

    C:
    int func( unsigned char *desc, int *destlen, const unsigned char*source, int sourclen)VB:
    Function func(desc as long, destlen as integer, source as long , sourclen as integer) as integer
      

  4.   

    Declare Function func Lib "mylib.dll" (desc As Byte, desclen As Long, source As Byte, ByVal sourcelen As Long)把上面代碼的聲明放到模塊變量中Module1.bas