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

2018-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2018 11:28 PM, cc wrote: Woops, that GetIntPtr came from the .cs header in the same folder as the C++ headers distributed with the SDK, that'll teach me to ctrl+f "class ISteamClient" in all open files and copy/paste before reading. Stay with the c/c++ headers for c/c++ code. We

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

2018-06-10 Thread cc via Digitalmars-d-learn
On Sunday, 10 June 2018 at 10:47:58 UTC, rikki cattermole wrote: On 10/06/2018 10:29 PM, cc wrote: And it successfully fires the 3-arg Run method of the callback object. However for some reason the function table of the ISteamClient seems to be off by one.. it kept calling the wrong methods

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

2018-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2018 10:29 PM, cc wrote: And it successfully fires the 3-arg Run method of the callback object. However for some reason the function table of the ISteamClient seems to be off by one.. it kept calling the wrong methods until I commented one out, in this case GetIntPtr() as seen above,

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

2018-06-10 Thread cc via Digitalmars-d-learn
On Sunday, 10 June 2018 at 02:57:34 UTC, evilrat wrote: 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... Thanks to the information

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

2018-06-09 Thread evilrat via Digitalmars-d-learn
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

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

2018-06-09 Thread cc via Digitalmars-d-learn
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

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

2018-06-09 Thread evilrat via Digitalmars-d-learn
On Saturday, 9 June 2018 at 03:14:13 UTC, cc wrote: On Saturday, 9 June 2018 at 03:07:39 UTC, cc wrote: I've put together a simplified test program here (124KB): Here is a pastebin of the D source file updated with some additional comments at the end with the callback class definitions from

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

2018-06-08 Thread cc via Digitalmars-d-learn
Sample output: Initializing. User logged on: true Starting request. hid: 4838393704146785693 .. Request completed: NumberOfCurrentPlayers_t(1, 5828) Terminating. Not present: any indication that the registered callresult was executed.

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

2018-06-08 Thread cc via Digitalmars-d-learn
On Saturday, 9 June 2018 at 03:07:39 UTC, cc wrote: I've put together a simplified test program here (124KB): Here is a pastebin of the D source file updated with some additional comments at the end with the callback class definitions from the original header files

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

2018-06-08 Thread cc via Digitalmars-d-learn
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

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

2018-06-08 Thread evilrat via Digitalmars-d-learn
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!

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

2018-06-08 Thread cc via Digitalmars-d-learn
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

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

2018-06-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 June 2018 at 00:55:35 UTC, cc wrote: I've defined it in D, as per https://dlang.org/spec/cpp_interface.html#classes : change this to class, or even abstract class as shown in example extern(C++) { interface CCallbackBase { //this() { m_nCallbackFlags

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

2018-06-07 Thread Mike Parker via Digitalmars-d-learn
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

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

2018-06-07 Thread cc via Digitalmars-d-learn
Hello, I'm attempting to interface with the Steam API DLL in D and running into some trouble working with callbacks. I'm aware there's already a project here http://derelict-steamworks.dub.pm/ but it seems to have not yet addressed the same issue. Steam provides ways to poll for whether an