On 7/31/2015 12:27 PM, Óscar Fuentes wrote:
> Edward Diener <eldlistmaili...@tropicsoft.com>
> writes:
>
>>> Calling a virtual member requires an access to the vtable of the class.
>>> The vtable is defined on the dll that contains the class' code. If the
>>> class is not exported, the vtable is not exported. The errors you are
>>> seeing is the linker complaining about the missing vtable.
>>
>> So you are saying that any class with virtual functions must have the
>> class itself exported rather than the individual member functions when
>> using gcc ? Because with VC++ that is not the case, so it must be an
>> issue with gcc on Windows.
>
> Not sure what VC++ does, exactly, but this:
>
> https://msdn.microsoft.com/en-us/library/81h27t8c.aspx
>
> /quote
>
> If you export one virtual function in a class, you must export all of
> them, or at least provide versions that the client can use directly.
>
> If you have a class in which you are using selective member
> import/export with virtual functions, the functions must be in the
> exportable interface or defined inline (visible to the client).
>
> /end quote
>
> seems to say that you can't export some selected virtual members defined
> in .cpp files and hide the rest of the class.

In my example all declared virtual functions are exported/imported.

Please note that all versions of VC++, from 8 through the recent 14, 
have no problems compiling/linking the two shared libraries. VC++ does 
not require that implicit compiler-generated functions be 
exported/imported. It just works as is with what you declare and define.

But of course mingw-64/gcc/ld does have these problems. Yet I keep 
hearing that this is somehow my fault rather than that of 
mingw-64/gcc/ld. No doubt I am supposed to figure out the voodoo which 
will cause mingw-64/gcc/ld to work. Even when I ask where to report this 
problem I am shaken off as if I have done something wrong rather than 
that the mingw-64/gcc/ld compile-link system is broken in some way when 
it refuses to link the second shared library.



------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to