Sorry for the long question. I just wanted to include everything that I know about the problem at the moment.
I\'m using Visual Studio 2008 to create a Windows Form
Actually, I had to marshall the arrays as ByValArray. Otherwise the running environment had something to complain about:
"A first chance exception of type 'System.TypeLoadException' occurred in CalculationForm.exe
Additional information: Cannot marshal field 'fVel' of type 'PdWaveApi.PDWaveSample': Invalid managed/unmanaged type combination (Arrays fields must be paired with ByValArray or SafeArray)."
So, I changed the struct to this:
public struct PDWaveSample
{
[MarshalAs(UnmanagedType.I1)]
public bool bValid;
public float fPressure;
public float fDistance;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
public float[] fVel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4)]
public ushort[] nAmp
}
public struct PDWaveBurst {
[MarshalAs(UnmanagedType.ByValArray, SizeConst=4096)]
public float[] fST;
public float fWinFloor;
public float fWinCeil;
[MarshalAs(UnmanagedType.I1)]
public bool bUseWindow;
[MarshalAs(UnmanagedType.I1)]
public bool bSTOk;
[MarshalAs(UnmanagedType.I1)]
public bool bGetRawAST;
[MarshalAs(UnmanagedType.I1)]
public bool bValidBurst;
}