Dll Callback in C++ deklariert
Code:
typedef BOOL (*RESPONSE_FUNC)(UCHAR ucChannel, UCHAR ucResponseMsgID);
typedef BOOL (*CHANNEL_EVENT_FUNC)(UCHAR ucChannel, UCHAR ucEvent);
typedef void (*P_ANT_ARF)(RESPONSE_FUNC, UCHAR*);
typedef void (*P_ANT_AEF)(UCHAR, CHANNEL_EVENT_FUNC, UCHAR*);
Aufruf:
Code:
static BOOL Test_ChannelCallback(UCHAR ucChannel_, UCHAR ucEvent_);
static BOOL Test_ResponseCallback(UCHAR ucChannel_, UCHAR ucMessageId_);
ANT_AssignResponseFunction(Test_ResponseCallback, aucResponseBuffer);
ANT_AssignChannelEventFunction(USER_ANTCHANNEL,Test_ChannelCallback, aucChannelBuffer);
Delphiübersetzung von mir
Code:
function RESPONSE_FUNC(ucANTChannel: UCHAR; ucResponseMsgID: UCHAR): Boolean;
function CHANNEL_EVENT_FUNC(ucANTChannel: UCHAR; ucEvent: UCHAR): Boolean;
TFNANT_AssignResponseFunction = procedure(RESPONSE_FUNC: Pointer; var pucResponseBuffer: Array of UCHAR); cdecl;
TFNANT_AssignChannelEventFunction = procedure(ucANTChannel: UCHAR; CHANNEL_EVENT_FUNC: Pointer; var pucChannelBuffer: Array of UCHAR); cdecl;
Aufruf:
Code:
ANT_AssignResponseFunction(@RESPONSE_FUNC, aucResponseBuffer);
ANT_AssignChannelEventFunction(USER_ANTCHANNEL, @CHANNEL_EVENT_FUNC, aucChannelBuffer);
Der Callback funktioniert, aber ucResponseMsgID und ucEvent ist immer 0.
Muß ich noch was beachten ?
Gruß Wal