I would like to call a DLL function from Visual Basic.
In C, the DLL function looks like
typedef struct {
int values[8];
int etc;
} S;
int dllfunction(const S *s);
In Visual Basic, I have successfully defined the function as follows:
Friend Class MyDll
Public Structure S
Public Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8 As Integer
Public Etc As Integer
End Structure
Friend Declare Auto Function dllfunction Lib "mydll.dll" (ByRef S As S) As Integer
End Class
Calling the function is then possible with
Dim S as Dll.S
... (Initialize S member variables)
Dll.dllfunction(S)
I would like, instead of explicitly defining eight variables for int values[8]
, to use some sort of array than match the C array layout and that can be used (or easily copied from/into) a Visual Basic array. Is there any language construct that allows this?
Note that
Public Structure S
Public Values as Integer(4)
Public Etc As Integer
End Structure
is not allowed by the language.