У меня есть эта DLL вызов:AccessViolation во PInvoke
[DllImport("FreqCntPcIntf.dll", CallingConvention = CallingConvention.StdCall)]
public static extern Intf_ErrorType FreqCntIntf_Init(
ref byte InstNo,
string InstName,
string PortServerName,
ulong UartComPort,
ulong MaxBlockTime);
enum Intf_ErrorType
{
...
}
И декларация C++ заключается в следующем:
FREQCNTINTF_API Intf_ErrorType STDCALL FreqCntIntf_Init(InstanceNoType* InstNo, const char* InstName, const char* PortServerName, rsuint32 UartComPort, rsuint32 MaxBlockTime);
где:
typedef enum
{
....
} RSENUM8(Intf_ErrorType);
#define FREQCNTINTF_API __declspec(dllexport)
typedef rsuint8 InstanceNoType;
typedef unsigned char rsuint8;
#define RSENUM32(EnumName) Enum_##EnumName; typedef rsuint32 EnumName
Я получаю AccessViolation во время разговора. Где я должен искать ошибку?
ULONG в C# есть 8 байт в ширину, а не 4 байта –