[odb-users] Error creating multi-database query support code with objects containing composite values in Visual Studio 2010/2013 (MSVC)

Harald Frostel Harald.Frostel at jku.at
Tue Jan 21 15:01:47 EST 2014


Hi Boris,
 
The dynamic multi-database support seems to work, but unfortunately, I
realized, that with the new odb-compiler, I run into problems when
creating a library without multi-database support.
 
In my case I create a shared library containing static database code
for, lets say Sqlite. I use the same export/extern macros as with the
dynamic multi-database shared library (common layer).
 
When I try to link this Sqlite/odb shared library to an executable , I
get linker errors (Visual Studio) like the following:
 
error C2491:
'odb::query_columns<T,id_sqlite,odb::access::object_traits_impl<::ACompositeObject,id_sqlite>>::id_type_::key1'
: definition of dllimport static data member not allowed.
 
I compared the generated code (*-odb.hpp) from your new binary (2.3.1)
with the odb 2.3.0 compiler (which works in that case) and it seems that
the newly inserted MODEL_EXPORT macro is causing the errors here.
 
template <typename A>
  struct query_columns< ::ACompositeObject, id_sqlite, A >
  {
    // id
    //
    struct MODEL_EXPORT id_type_ // WAS: struct id_type_
    {
	  id_type_ ()
	  {
	  }
…
}
 
So, I'm not sure, if I'm using the export/extern macros correctly in
that case or the generated code is causing this issue.
 
Cheers
Harald
 
 
 
****************************************************
Dipl.-Ing. Harald Frostel
Department of Computational Perception
Johannes Kepler University Linz
Altenberger Strasse 69
A-4040 Linz, Austria	    
 
Tel:  +43 732 2468 1521
Fax:  +43 732 2468 1520
Mail: harald.frostel at jku.at
http://www.cp.jku.at/people/frostel
****************************************************


>>> Boris Kolpackov <boris at codesynthesis.com> 18.01.2014 10:12 >>>
Hi Harald,

Harald Frostel <Harald.Frostel at jku.at> writes:

> I would be interested in the pre-release binary. My platform is
Windows x64.

Here you go:

http://www.codesynthesis.com/~boris/tmp/odb/odb-2.3.1-i686-windows.zip

Let me know if there are any problems. And thanks for reporting this
bug and providing the test case!

Boris



More information about the odb-users mailing list