Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Arrays to C++ DLL Functions

Status
Not open for further replies.

MukeshMak

Technical User
Aug 6, 2002
19
CH
Hi all,

I'm trying to get a C++ dll to fill an array that has been passed to it using VB.

I use the following code to test the function:

*******************************************************
' Declare the C++ DLL Function
Private Declare Function test Lib "test.dll" ( ByRef intArray as Integer, ByVal arraySize as Integer) as Integer
.
.
' In my function
.
.
Dim iArray()
ReDim iArray(10)

test ( iArray(0), 10 )
.
.
' print the results... etc....
*******************************************************

Now the problem is that only the element iArray(0) is actually updated by the DLL although, I have verified that all elements are changed within it.

The function within the dll has been defined as:

*******************************************************
int __stdcall test ( int * intArray, int arraySize )
*******************************************************

Also the C++ dll works fine in conjunction with C++ programs.

Appreciate it if anyone could give me a hand with this.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top