我想從VB6應用程序調用C++編寫的DLL。什麼是C++ char數組的VB6等價物?
下面是調用該DLL的C++代碼示例。
char firmware[32];
int maxUnits = InitPowerDevice(firmware);
但是,當我嘗試從VB6調用它時,出現錯誤bad DLL calling convention
。
Public Declare Function InitPowerDevice Lib "PwrDeviceDll.dll" (ByRef firmware() As Byte) As Long
Dim firmware(32) As Byte
InitPowerDevice(firmware)
編輯:C++函數原型:
Name: InitPowerDevice
Parameters: firmware: returns firmware version in ?.? format in a character string (major revision and minor revision)
Return: >0 if successful. Returns number of Power devices connected
CLASS_DECLSPEC int InitPowerDevice(char firmware[]);
這是伸展我的記憶中了一點,但它是不是BYVAL x作爲字符串? – PeteH
@PeteH:我試過了,它也沒有工作。 –
你能找到那個'CLASS_DECLSPEC'宏的定義嗎? –