I'm new in delphi, my program developed in delphi working with a dll developed in C++, I need working with pointer functions that throw exceptions of Access Violation address and after many test I don't know how resolve It.
this is defintion of the pointer function in delphi that translate since header c++
type
TMICRCallback = function: Integer of Object; stdcall;
TStatusCallback = function(dwParam: Cardinal): Integer of Object; stdcall;
type
TBiMICRSetReadBackFunction =
function(const nHande: Integer;
pMicrCB: TMICRCallback;
var pReadBuffSize: Byte;
var readCharBuff: Byte;
var pStatus: Byte;
var pDetail: Byte
): Integer; stdcall;
var
BiMICRSetReadBackFunction: TBiMICRSetReadBackFunction;
type
TBiMICRSetReadBackFunction =
function(const nHande: Integer;
pMicrCB: TMICRCallback;
var pReadBuffSize: Byte;
var readCharBuff: Byte;
var pStatus: Byte;
var pDetail: Byte
): Integer; stdcall;
var
BiMICRSetReadBackFunction: TBiMICRSetReadBackFunction;
this is a code that call the pointer functions
type
function CBMICRRead : Integer; stdcall;
function CBMICRStatus(dwStatus: LongWord) : Integer; stdcall;
Respuesta : TMICRCallback;
Estado : TStatusCallback;
BiSetStatusBackFunction(m_hApi, Estado);
BiMICRSetReadBackFunction (m_hApi,
Respuesta,
m_MICRReadBuffSize,
m_MICRReadBuff[0],
m_MICRReadStatus,
m_MICRReadStDetail);
This is the C++ side of the interface:
typedef int (CALLBACK* MICRCallback)(void);
typedef int (CALLBACK* StatusCallback)(DWORD);
int WINAPI BiSetStatusBackFunction(int nHandle,
int (CALLBACK *pStatusCB)(DWORD dwStatus));
int WINAPI BiMICRSetReadBackFunction(int nHandle,
int (CALLBACK *pMicrCB)(void),
LPBYTE pReadBuffSize,
LPBYTE readCharBuff,
LPBYTE pStatus,
LPBYTE pDetail);