Say I have two Delphi methods:
// Delphi
procedure FuncNoParam();
procedure FuncWithParam(myInt: Integer);
These need to be provided to a C++ DLL. The DLL will then call these methods when some event occurs:
// C++
int event = GetLatestEvent();
if (event <= 0)
funcNoParam();
else if (event < 10)
funcWithParam(event);
else
DoSomethingElse();
How do I package up the Delphi methods, pass them to the C++ DLL and save them for future use like a CALLBACK?
UPDATE
Some comments suggested this question was a duplicate. There is some overlap, but that question does not address two aspects:
- an example of how to define the above, less complex, methods which are
void
in C++ - how to save the function in the C++ DLL for later use