C++ interface problem

Benjamin Thaut via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 30 01:18:15 PDT 2015


On Wednesday, 29 April 2015 at 19:04:11 UTC, extrawurst wrote:
> 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...

Did you try windows 64-bit? Calling conventions on 64-bit windows 
are better standardized.


More information about the Digitalmars-d-learn mailing list