dotnet interop:
I have a third-party DLL (unmanaged) for which I am trying to call a
function. The function requires a structure (as an argument) which
utilized several variables I am unable to translate.
The original C header structures contain (amongst other things that I
have already translated):
typedef byte TPacketType[int(100)];
struct TModuleRec
{
/*1 byte*/ bool Succeeded;
/*4 bytes*/ char *Error;
/*4 bytes*/ char *ProjectFiles[7];
/*4 bytes*/ int ProjectFilesStart[7];
byte EEPROM[50];
TPacketType PacketBuffer;
}
I've been able to translate everything so far except for these
particular variables. I've tried (as suggested on some interop articles
I've read)
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> Public
Class TPacketType
Public TPacketType(100) As Byte
End Class
<StructLayout(LayoutKind.Sequential)> Public Class TModuleRec
<MarshalAs(UnmanagedType.U1)> Public Succeeded As Boolean
Public Err(4) As Byte
Public ProjectFiles(7) As Byte
Public ProjectFilesStart(7) As Integer
Dim EEPROM(50) As Byte
Public EEPROMFlags(50) As Byte
Public PacketBuffer As TPacketType
End Class
for the booleans, but this still results in "non-primitive or
non-blittable" structure errors (I remarked out the unmarshalled Bools
during testing).
I'd really like to understand why the MarshalAs isn't working (as well