Assigning an Existing Routine

Top  Previous  Next

New features since Delphi 7 > Anonymous Methods > Assigning an Existing Routine

 

1 Assigning a Free Procedure / Function

 

Delphi

 

p := GlobalProc;

 

C++ portable

 

p = &GlobalProc;

 

C++Builder

 

p = d2c::bind_free_proc0(&GlobalProc);

 

 

Free functions can be assigned directly if their signature matches.

 

 

2 Assigning an Instance Method

 

Delphi

 

p := Obj.Method;

 

 

C++ portable

 

p = d2c::make_callback(Obj, &TClass::Method);

 

 

C++Builder

 

p = d2c::bind_proc0(Obj, &TClass::Method);

 

 

the generated callable internally binds the object pointer and forwards calls to the member function.

 

 

 

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content