<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Dennis via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Mo., 21. Okt. 2024, 05:09:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<blockquote type="cite">
<div dir="auto">
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I am expected to create and pass an instance of such class
<br>
ApiProxyWrapperReply in my calling program<br>
via a function<br>
void
SPAPI_RegisterApiProxyWrapperReply(ApiProxyWrapperReply* <br>
apiProxyWrapperReply);<br>
<br>
and the external library will then call the various
methods of <br>
ApiProxyWrapperReply as 'call-back' functions when
needed.<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Considering that the class only has abstract
virtual methods and the destructor is non-virtual you *might*
be able to do this by declaring a raw interface ({$Interfaces
Corba}) and declaring all the virtual methods in the same
order (very important!) with suitable signatures and calling
convention (for i386 you should pick cppdecl otherwise the
system default should be alright), implementing that interface
in some Object Pascal class and then passing an instance of
that interface to the library.</div>
<div dir="auto"><br>
</div>
<div dir="auto">It could still go wrong due to some differences
in the ABI, but it might just as well work. 🤷♀️</div>
<div dir="auto"><br>
</div>
</div>
</blockquote>
<p>In C++, I was expected to pass the class instance to the external
library. So, In Pascal, do I pass the interface variable to the
external library?</p></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Correct. As I said however: it *might* work, no guarantee. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven</div></div>