Passing C++ class to DLL for callbacks from D (Steam)
evilrat
evilrat666 at gmail.com
Sun Jun 10 02:57:34 UTC 2018
On Sunday, 10 June 2018 at 01:35:40 UTC, cc wrote:
> On Saturday, 9 June 2018 at 14:11:13 UTC, evilrat wrote:
>> However steam devs decided to shield actual pointer and return
>> pointer sized integer when C API is used(or they just screw
>> up?). Anyway, the pointers for subsystems returned by context
>> calls on C++ API and mirrored C API calls are different, but
>> they also have some mechanism for filtering this stuff, that
>> way both integer handle and pointer calls the same underlying
>> implementation, but C API call again is shielded so setting up
>> CallResult and CCallback are ignored.
>>
>>
>> So my solution was just to make simple wrapper around C++
>> context calls and pass that real pointer to D side.
>
> I see, thank you for checking it out. Is it only the functions
> that return the interface pointers e.g. ISteamUserStats that
> need to be wrapped to use the class-based versions instead of
> the steam_api_flat versions? Or does the entire callback
> system need to be handled through the wrapper?
Only subsystems getters like SteamUser() or SteamInventory()
requires wrapping.
I really can't understand why they ever choose to silently ignore
registering callbacks received with C API systems handles...
More information about the Digitalmars-d-learn
mailing list