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.

  1. procedure equivalent void function in c/c++.
  2. in visual c++, this pointer passed in ecx register , default calling convention member function equivalent __stdcall except when passed variadic argument, changes __cdecl. callback should correctly except calling convention.

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -