typedef void (*onPaymentResultCallback) (int result);
DLL_EXPORT int AR_payment_item_credit(const char *terminal_no, const char *description, double amount, enum currency_id cid, int receiptid,
onPaymentResultCallback cb);
をデルファイするC/C++コールバックfunctonを変換する:どのように私はこのようなdefinetions上で変換
TonPaymentResultCallback = procedure(result:LongInt) of object;
function AR_payment_item_credit(HInst:THandle; const TerminalNo:PAnsiChar; const Description:PAnsiChar; Amount:Double; CurrencyId:LongInt;
RecepitID:LongInt; onPaymentResultCallback:tonPaymentResultCallback):LongInt;
var
MyFunct: function (const TerminalNo:PAnsiChar; const Description:PAnsiChar; Amount:Double; CurrencyId:LongInt;
RecepitID:LongInt; onPaymentResultCallback:tonPaymentResultCallback): LongInt; cdecl;
begin
Result := 0;
MyFunct:=GetProcAddress(HInst,'AR_payment_item_credit');
if Assigned(MyFunct) then
Result := MyFunct(TerminalNo, Description, Amount, CurrencyId, RecepitID,onPaymentResultCallback);
end;
私は、Delphiに変換するC/C++ DLL関数を知っているが、コールバックは私のために新しく追加されました。 私の定義は正しいですか?
C、C++のどの言語ですか?彼らは異なる言語です。たとえば、C++にはオペレータと関数のオーバーロードがあり、名前のマングリングが発生する可能性があります。 –
Cの関数はcdeclのように見えます –