C++ interface problem

Benjamin Thaut via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 27 09:24:15 PDT 2015


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


More information about the Digitalmars-d-learn mailing list