Hi
I'm writing an application delphi that use an external dll compiled in c++.
This Dll is a collection of function to control a USb external device.
For report a status the Dll have a function of callback.
I have the problem of receive callback because when the dll call my function i have a memory error.
Probably there is a problem on my application but i don't find it, it is the fist time that solve this problem.
I defined the dll and callback function:
var testdll:Thandle;
TesterDll_Driver_SetStatusCallback : function(TesterDll_StatusUpdateCallbackPointer: status_cb):integer; stdcall;
// other functions
I defined on type my callback procedure:
type status_cb = procedure (status_flag:integer); stdcall;
In the application load the dll:
testdll := safeLoadLibrary('TesterDll.dll');
if testdll >= 32 then { success }
begin
// other functions
TesterDll_Driver_SetStatusCallback := GetProcAddress(testdll,'TesterDll_Driver_SetStatusCallback');
My callback procedure:
procedure status_cbp(status_flag:integer) ; stdcall;
begin
//// code
end;
and finally set the callback function:
TesterDll_Driver_SetStatusCallback(status_cbp);
Someone can help me?
Paolo
I'm writing an application delphi that use an external dll compiled in c++.
This Dll is a collection of function to control a USb external device.
For report a status the Dll have a function of callback.
I have the problem of receive callback because when the dll call my function i have a memory error.
Probably there is a problem on my application but i don't find it, it is the fist time that solve this problem.
I defined the dll and callback function:
var testdll:Thandle;
TesterDll_Driver_SetStatusCallback : function(TesterDll_StatusUpdateCallbackPointer: status_cb):integer; stdcall;
// other functions
I defined on type my callback procedure:
type status_cb = procedure (status_flag:integer); stdcall;
In the application load the dll:
testdll := safeLoadLibrary('TesterDll.dll');
if testdll >= 32 then { success }
begin
// other functions
TesterDll_Driver_SetStatusCallback := GetProcAddress(testdll,'TesterDll_Driver_SetStatusCallback');
My callback procedure:
procedure status_cbp(status_flag:integer) ; stdcall;
begin
//// code
end;
and finally set the callback function:
TesterDll_Driver_SetStatusCallback(status_cbp);
Someone can help me?
Paolo