i've found a solution
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void device_has_connected(AM3_OEM_DEVICE device_connected);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void device_has_disconnected(AM3_OEM_DEVICE device_connected);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void device_status_update(AM3_OEM_DEVICE device_connected, uint status);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void device_acquisition_available(AM3_OEM_DEVICE device_connected, ref uint millisecond, uint size);
[StructLayout(LayoutKind.Sequential)]
public struct AM3_OEM_DEVICE_MANAGER
{
public IntPtr DeviceHasConnected;
public IntPtr DeviceHasDisconnected;
public IntPtr DeviceStatusUpdate;
public IntPtr AcquisitionAvailable;
}
You call the structure with
g_device_manager = new AM3_OEM_DEVICE_MANAGER
{
DeviceHasConnected = Marshal.GetFunctionPointerForDelegate(new device_has_connected(DeviceHasConnected)),
DeviceHasDisconnected = Marshal.GetFunctionPointerForDelegate(new device_has_connected(DeviceHasDisconnected)),
DeviceStatusUpdate = Marshal.GetFunctionPointerForDelegate(new device_status_update(DeviceStatusUpdate)),
AcquisitionAvailable = Marshal.GetFunctionPointerForDelegate(new device_acquisition_available(DeviceAcquisitionAvailable))
};