Passing C++ class to DLL for callbacks from D (Steam)

cc cc at nevernet.com
Sat Jun 9 03:07:39 UTC 2018


On Friday, 8 June 2018 at 07:32:54 UTC, evilrat wrote:
> On Friday, 8 June 2018 at 06:59:51 UTC, cc wrote:
>> On Friday, 8 June 2018 at 02:52:10 UTC, Mike Parker wrote:
>>> On Friday, 8 June 2018 at 00:55:35 UTC, cc wrote:
>>>
>>>>
>>>> class CImpl : CCallbackBase {
>>>> 	extern(C++) {
>>>
>>>> If anyone has any insight to provide it would be greatly 
>>>> appreciated, thanks!
>>>
>>> I've not used any of the C++ interfacing features yet, but my 
>>> understanding is the extern(C++) has to apply to the class 
>>> declaration itself, not only the member functions:
>>>
>>> extern(C++)
>>> class CImpl : CCallbackBase {
>>>
>>> Does that make a difference?
>>
>> Tried wrapping the CImpl class in extern(C++), no luck.. tried 
>> final keyword on the methods too.  Thanks though.
>
> Can you upload reduced example somewhere to play with?

I've put together a simplified test program here (124KB):
https://drive.google.com/uc?id=1VPxCcPShlYpGo8BggxniNlPH96iIRG8_&export=download

The official SDK can be downloaded here (including the 
steam_api.dll if you don't want to use the one in the zip for 
security):
https://partner.steamgames.com/doc/sdk
Although it may require a developer account to download.

Also I should note that Steam differentiates between "callbacks" 
(events that may be fired to the application that registers to 
listen for them at any time or multiple times) and "call results" 
(1:1 asynchronous requests, I believe).  This test so far is 
using call results.



More information about the Digitalmars-d-learn mailing list