[odb-users] Use of persistent class with virtual member in another module (linker error)

Boris Kolpackov boris at codesynthesis.com
Mon Feb 18 07:24:53 EST 2019


Сергей Никонов <shprotello at mail.ru> writes:

> error LNK2019: unresolved external symbol "__declspec(dllimport) public:
>  __cdecl odb::query_columns<class ::person,2,struct odb::alias_traits<class
>  ::person,2,struct odb::access::object_traits<class ::dummy>::p_tag>
>  >::p_class_::p_class_(void)"... referenced in function "void __cdecl
>  `dynamic initializer for 'public: static struct odb::query_columns<class
>  ::person,2,struct odb::alias_traits<class ::person,2,struct
>  odb::access::object_traits<class ::dummy>::p_tag> >::p_class_ const
>  odb::query_columns<class ::person,2,struct odb::alias_traits<class
>  ::person,2,struct odb::access::object_traits<class ::dummy>::p_tag>
>  >::p''(void)"
> 
> The questions are:
> - Is it possible to use virtual members in the described context?

It should be possible.


> - and if so, what I did wrong?

Using Windows? ;-)

Seriously though, DLL-exporting of things like template instantiations is
a murky business, see Section 16.2.2, "Dynamic Loading of Database Support 
Code" for some background (specifically, --extern-symbol).

I would also diff the generated code for the two cases to see if that gives
any hints.



More information about the odb-users mailing list