Is there any specific method for calling a c++ dll that requires a int
array from c#. I have tried using int[] array1 = { 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; but the values aren't being
received correctly by the c++ dll.
Without the signature of the C++ function and the way you've attempted to
call it it's impossible to help you.
Hi Thanks for the response here is the code used on the c# side.
[DllImport("mydll.dll", CharSet = CharSet.Auto, EntryPoint = "Init")]
public static extern unsafe IntPtr Init(byte[] dir, int Number1, int
Number2, int Number3, byte[] byteArray1, byte[] byteArray2, int[]
intarray1, byte singlebyte, int Number4, int Number5, int SingleInt,
byte SingleByte);
Calling it:
int[] intarray1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16 };
//Initialise
handle = InitChannel(dir, Number1, Number2, Number3, byteArray,
byteArray2, intarray1, 0, 0, 0, 0, 1);
C++ side in the dll.
extern "C" MYEXPORT void* __stdcall Init(char *dir, int Number1, int
Number2, int Number3, bool *byteArray, bool *byteArray2, int *
intarray1,
bool boolsingle, int intsingle, int intsingle2, int intsingle3,
bool boolsingle2)
All of the other arguments are received properly just not the int[]
array. Any help would be appreciated.