从VB6调用简单的VC DLL
我有一个用VC6编写的简单DLL,其中有一个函数:从VB6调用简单的VC DLL,vb6,dllimport,Vb6,Dllimport,我有一个用VC6编写的简单DLL,其中有一个函数: __declspec(dllexport) int myfunc(long a, unsigned char *b, unsigned char *c, unsigned char *d, unsigned char *e) 我使用以下命令从vb6调用它: Declare Function myfunc Lib "mylib.dll" (ByVal a As Long, ByVal b As String, ByVal c As String
__declspec(dllexport) int myfunc(long a, unsigned char *b, unsigned char *c, unsigned char *d, unsigned char *e)
我使用以下命令从vb6调用它:
Declare Function myfunc Lib "mylib.dll" (ByVal a As Long, ByVal b As String, ByVal c As String, ByVal d As String, ByVal e As String) As Long
....
dim a as long
dim b as string
dim c as string
dim d as string
dim e as string
dim r as long
r=myfunc(a,b,c,d,e)
我得到“坏dll调用约定”错误,但我不明白为什么。有什么想法吗?一般来说,“坏DLL…”就是它所说的意思。VB6调用的任何外部函数都需要_stdcall约定(如Win API)
尝试向C函数原型中添加
\uu stdcall
,看看会发生什么。一般来说,“坏DLL…”就是它所说的意思。VB6调用的任何外部函数都需要_stdcall约定(如Win API)
尝试向C函数原型添加
\uu stdcall
,看看会发生什么。查看Paul Caton的Universal DLL函数调用程序:
它允许您从VB6调用几乎任何类型的函数。查看Paul Caton的Universal DLL函数调用程序: 它将允许您从VB6调用几乎任何类型的函数