Callback in Free Pascal from C++ DLL -
there declarations in proprietary dll header:
class cjdummyclass { }; typedef cjdummyclass * j_img_callback_object; #ifdef __borlandc__ typedef void (__stdcall*j_img_callback_function)(j_timage_info * paqimageinfo); #else typedef void (cjdummyclass::*j_img_callback_function)(j_timage_info * paqimageinfo); #endif also there exported function link callback function dll, , possible process data placed in memory pointer paqimageinfo
i'm writing application using dll in freepascal, need translated, dynamically linked , wrapped class, have problem callback function. here part of code:
interface type pj_timage_info = ^j_timage_info; tj_img_callback_function = procedure( const paqimageinfo: pj_timage_info ) of object; cdecl; pj_img_callback_function = ^tj_img_callback_function; tjaifactory = class( tobject ) ..... procedure imagecallback( const paqimageinfo: pj_timage_info ); cdecl; ..... end; implementation procedure tjaifactory.imagecallback(paqimageinfo: pj_timage_info); cdecl; begin // data processing here end; insidy imagecallback got paqimageinfo = nil instead of actual pointer. suspect have define type or parameters callback other way, don't know how.
first question: if in c++ there void function far understand procedure in terms of pascal , should defined procedure or function pointer result (but without actual result)?
second question: if function declared in c++ member of class, correct way translate type of function pascal? i'm not sure going on "this" pointer.
thank you.
- procedure equivalent void function in c/c++.
- in visual c++,
thispointer passed inecxregister , default calling convention member function equivalent__stdcallexcept when passed variadic argument, changes__cdecl. callback should correctly except calling convention.
Comments
Post a Comment