T
Thivierge.M
Hi, I have a DLL in C which expects an array of short. I need to pass the
array from a VBA application. It seems not to work. Could you help me please?
My DLL is written in C++ and compiled with the __stdcall calling convention.
I exported my function in myDLL.def file.
The interface is defined as follows:
extern "C" __declspec(dllexport) short __stdcall myDLLfunc(unsigned short
*nWords, unsigned short *pBuf);
nWords is the number of words,
pBuf is an array of unsigned short values.
In my VBA code I declared myDLLfunc as follows:
Public Declare Function myDLLfunc "myDLL" (ByRef pNbWords As Integer, ByRef
pBuf() As Integer)
Then I use the following to call myDLLfunc:
Dim nWords As Integer
Dim data(1 To 32) As Integer
Call myDLLfunc(nWords, data())
With this, it seems that the address of the data() array is not right since
the values in the data() array are not as expected.
What did I miss?
Thanks for your help.
Michel
array from a VBA application. It seems not to work. Could you help me please?
My DLL is written in C++ and compiled with the __stdcall calling convention.
I exported my function in myDLL.def file.
The interface is defined as follows:
extern "C" __declspec(dllexport) short __stdcall myDLLfunc(unsigned short
*nWords, unsigned short *pBuf);
nWords is the number of words,
pBuf is an array of unsigned short values.
In my VBA code I declared myDLLfunc as follows:
Public Declare Function myDLLfunc "myDLL" (ByRef pNbWords As Integer, ByRef
pBuf() As Integer)
Then I use the following to call myDLLfunc:
Dim nWords As Integer
Dim data(1 To 32) As Integer
Call myDLLfunc(nWords, data())
With this, it seems that the address of the data() array is not right since
the values in the data() array are not as expected.
What did I miss?
Thanks for your help.
Michel