
passing arrays of user defined types to dll's
Quote:
>I'd like to pass an array of user defined type
>to a dll by reference. I'm not sure whether
>what I'm doing is a correct way. Could somebody
>give me a hint before I waste too much time?
When you call the function, pass it the first element of the array. E.g.
/* C code */
typedef struct
{
int i;
long l; // or whatever
} MyType;
void FAR Pascal _export MyDllFunction(MyType FAR *MyArray);
' VB code
Type MyType
i as Integer
l as Long ' or whatever
End Type
Declare Sub MyDllFunction Lib "MyDll.Dll" (ArrayName As MyType)
.
.
.
Dim MyArray(1 To 10) As MyType
Call MyDllFunction(MyArray(1))
-Andy Cook.