C++ interface problem

extrawurst via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 27 14:19:00 PDT 2015


On Monday, 27 April 2015 at 16:24:16 UTC, Benjamin Thaut wrote:
> Am 27.04.2015 um 17:16 schrieb extrawurst:
>> On Monday, 27 April 2015 at 13:14:21 UTC, Benjamin Thaut wrote:
>>> On Monday, 27 April 2015 at 13:08:33 UTC, extrawurst wrote:
>>>>
>>>> Don't ask me about the compiler, like stated above I have no 
>>>> control
>>>> over the binaries, it is proprietary.
>>>
>>> Thats bad to start with.
>>>
>>>>
>>>> the C++ class basically is:
>>>>
>>>> ```
>>>> class S
>>>> {
>>>> union SteamID_t
>>>>    {
>>>>        struct SteamIDComponent_t
>>>>        {
>>>>            uint32                m_unAccountID : 32;
>>>>            unsigned int        m_unAccountInstance : 20;
>>>>            unsigned int        m_EAccountType : 4;
>>>>            EUniverse            m_EUniverse : 8;
>>>>        } m_comp;
>>>>
>>>>        uint64 m_unAll64Bits;
>>>>    } m_steamid;
>>>> }
>>>> ```
>>>
>>> Where is the fuction declaratiosn for bar? If bar is not 
>>> virtual you
>>> can not use a extern(C++) Interface. If bar is non-virtual 
>>> you have to
>>> use a extern(C++) class.
>>
>> of course it is all virtual. it is a c++-interface. and 
>> everything works
>> fine under osx, that would not be the case otherwise, right ?
>
> It depends on the compiler, I don't know the vtbl layout on 
> OSX. Does the class have a virtual destructor? If you would 
> post a bit more of S declaration I wouldn't have to guess into 
> the blue. Not knowing the compiler your third party library was 
> compiled with doesn't really help either.
>
> Kind Regards
> Benjamin

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.


More information about the Digitalmars-d-learn mailing list