G
Guest
Hi
since no forum can't help me, I hope this one does
My Problem
I have to use an unmanaged C++-DLL (Windows CE), which I do import by P/Invoke in my C# project. One of the DLL-functions needs as a parameter a reference to a struct.
I built this struct in my C# project, but unfortunatelly I can't set the array size (of byte) to
fix size (only in the constructor of the structure)
The struct looks like this
public struct sStruc
public byte number
public byte figure
public public byte[] byteArray
public sStruct(byte num, byte fig, int size
this.number = num
this.figure = fig
byteArray = new byte[size]
The prototyp after DLLimport looks like this
public static extern void miniDLL_ComplexReference(ref sStruct structure)
The problem is, that by call of the function the size of my struct is unknow
and the array inside the passed struct is not filled correctly
I tryed to put the struct into a class.... but I can't marshal it correctly, since C
doesn't suppoert "MarshalAs" or "FieldOffset"
Ist there a way to get this problem solved?
since no forum can't help me, I hope this one does
My Problem
I have to use an unmanaged C++-DLL (Windows CE), which I do import by P/Invoke in my C# project. One of the DLL-functions needs as a parameter a reference to a struct.
I built this struct in my C# project, but unfortunatelly I can't set the array size (of byte) to
fix size (only in the constructor of the structure)
The struct looks like this
public struct sStruc
public byte number
public byte figure
public public byte[] byteArray
public sStruct(byte num, byte fig, int size
this.number = num
this.figure = fig
byteArray = new byte[size]
The prototyp after DLLimport looks like this
public static extern void miniDLL_ComplexReference(ref sStruct structure)
The problem is, that by call of the function the size of my struct is unknow
and the array inside the passed struct is not filled correctly
I tryed to put the struct into a class.... but I can't marshal it correctly, since C
doesn't suppoert "MarshalAs" or "FieldOffset"
Ist there a way to get this problem solved?