[odb-users] undefined reference link error when use odm.dll

Boris Kolpackov boris at codesynthesis.com
Fri Sep 3 08:58:24 EDT 2021


Alessandro Catania <alcatania at gmail.com> writes:

> I work on c++ code that use orm 2.3.0 on windows an gcc compiler.

Very old version, you should consider upgrading.


> Orm code is generated by odb and is a library (that I call orm.dll) and
> contains polymorphism, in particular some destructors are defined pure
> virtual in base class. Empty destructors are implemented in Cxx source.
> Symbols are exported in my orm library as explained in manual in "16.2.2
> Dynamic Loading of Database Support Code"
> 
> This library compile correctly, but when I use it in another part of code
> linker give error undefined reference for destructors of base classes
> (defined as virtual).

Are these the pure virtual or the empty from your description above?


> Could be that destructors symbols of base classes are not exported?
> But orm should export all class and then also destructors.

This is most likely an idiosyncrasy of Windows DLL exporting semantics.
If these are the pure virtual destructors we are talking about, make
sure their classes have some non-inline function definition to "anchor"
the vtable (and if there aren't any, try to turn the pure virtual
destructor into just virtual with an non-inline definition).



More information about the odb-users mailing list