A
Arnau Font
Hi,
I'm using a DLL that has a function which receives a pointer to a struct
like this (in c++):
struct Example{
int var1;
BYTE buff[20];
char res;
}
The function:
int function (Example* ex) {
return 0;
}
I'd like to have something like this (in C#):
public struct Example {
int var1;
byte buff[20]; //Yes, it is wrong, but I want a fixed size array!
//byte[] buff; //this wouldn't be passed correctly, would it?
char res;
}
[DllImport("MyDLL.dll")]
static public extern int function(ref Example ex);
Or should I receive the structure as a byte array and convert it?
Thanks!
I'm using a DLL that has a function which receives a pointer to a struct
like this (in c++):
struct Example{
int var1;
BYTE buff[20];
char res;
}
The function:
int function (Example* ex) {
return 0;
}
I'd like to have something like this (in C#):
public struct Example {
int var1;
byte buff[20]; //Yes, it is wrong, but I want a fixed size array!
//byte[] buff; //this wouldn't be passed correctly, would it?
char res;
}
[DllImport("MyDLL.dll")]
static public extern int function(ref Example ex);
Or should I receive the structure as a byte array and convert it?
Thanks!