C++ interface problem

extrawurst via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 29 12:04:09 PDT 2015


On Wednesday, 29 April 2015 at 13:55:46 UTC, Benjamin Thaut wrote:
> On Monday, 27 April 2015 at 21:19:02 UTC, extrawurst wrote:
>>
>> here is the shortened version of the returned class CSteamID:
>> https://gist.github.com/Extrawurst/936f56ceaa87cf287257
>>
>> this is the shortened interface (no destructors in the rest of 
>> the code either):
>> https://gist.github.com/Extrawurst/b20dc5ab84132ecab30d
>>
>> the method `GetFriendByIndex` is the one crashing on win32.
>
> I assume that's because CSteamID is returned by value. Are you 
> defining CSteamID in D as a struct? If not you have to because 
> only structs can be returned by value. The next problem is that 
> CSteamID is 64bits wide, this might be a problem as it can not 
> be returned in a single register. You could try changeing the 
> definition of GetFriendByIndex on the D side to
>
> ulong GetFriendByIndex(...) and reinterpret the ulong on the D 
> side. If that does not work however you are most likely out of 
> luck because the way your c++ library returns a value type > 
> 32-bit is not compatible with what dmd expects. Do you have 
> debug symbols for the third party c++ library? Can you step 
> into the virtual function call to actually see if it ends up in 
> the correct function on the c++ side?
>
> Kind Regards
> Benjamin Thaut

Seems i am out of luck. I tried all that. The Steamworks SDK is 
closed source without debugging symbols. so it wont work.. too 
bad, this library would have been a good example case of seamless 
c++-interfacing from D...


More information about the Digitalmars-d-learn mailing list