我在VC写了个DLL,原型如下:
extern "C" void __declspec(dllexport)Test(char *);
void Test(char *input)
{
input[0] = 'h';
input[1] = 'e';
input[2] = 'l';
input[3] = 'l';
input[4] = 'o';
input[5] = '\0';
}在VC调用的方法是
char a[6];
Test(a);意思是先创建6个字节的空间,然后把这6个字节的首地址传入函数,在函数里面为这6个字节填值,那我在VB里面应该怎么调用这个DLL?
我试了
Declare Function Test Lib "mydll.dll" (ByRef a() As Byte)
Declare Function Test Lib "mydll.dll" (ByRef a As Byte)
Declare Function Test Lib "mydll.dll" (ByRef a As string)都不行
extern "C" void __declspec(dllexport)Test(char *);
void Test(char *input)
{
input[0] = 'h';
input[1] = 'e';
input[2] = 'l';
input[3] = 'l';
input[4] = 'o';
input[5] = '\0';
}在VC调用的方法是
char a[6];
Test(a);意思是先创建6个字节的空间,然后把这6个字节的首地址传入函数,在函数里面为这6个字节填值,那我在VB里面应该怎么调用这个DLL?
我试了
Declare Function Test Lib "mydll.dll" (ByRef a() As Byte)
Declare Function Test Lib "mydll.dll" (ByRef a As Byte)
Declare Function Test Lib "mydll.dll" (ByRef a As string)都不行
Declare Function Test Lib "mydll.dll" (a As any)看有用不?这东东我也不太清楚,只见人这样用过,VB是没有指针的
Declare Function Test Lib "mydll.dll" (byval a As string)vb调用api时能自动处理字符串。不过要预先设定长度,再作为参数传递
dim I as string * 255