[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
Wed Jan 22 05:43:01 EST 2014


Hi Boris,


yes, I know that this is necessary for the dynamic multi-database support with shared libraries for each layer. This works now with the new compiler binary you sent me.


In another case however I don't use dynamic multi-database support. I just generate static database code for Sqlite and pack it into a shared library. Than I want to use this shared library in one or more executables. This case does not work anymore with the new odb compiler.


When I compile the Sqlite shared library, I define a BUILD_DLL (MODEL_BUILD_DLL in the test case I sent you) macro which leads to an export of the structs etc. When I build an executable, that uses the shared library, the import macros are used.
As far as I can tell this should work and it worked with the official 2.3.0 compiler but not anymore with the 2.3.1 binary you sent me.


If I find time today, I'll create a test code for this constellation.
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> 22.01.2014 09:58 >>>
Hi Harald,

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

> I use the same export/extern macros as with the dynamic multi-database
> shared library (common layer).
>  
> template <typename A>
> struct query_columns< ::ACompositeObject, id_sqlite, A >
> {
>	 struct MODEL_EXPORT id_type_ // WAS: struct id_type_

You need to use a separate set of export/extern macros for each DLL
that you create. That is, you would have MODEL_EXPORT for the common
interface, MODEL_SQLITE_EXPORT for the SQLite implementation,
MODEL_MYSQL_EXPORT for MySQL, etc.

When you are building the SQLite implementation DLL, MODEL_EXPORT
should be set to import while MODEL_SQLITE_EXPORT to export. When
building your application, both MODEL_EXPORT and MODEL_SQLITE_EXPORT
should be set to import.

Can you check this and let me know whether this was the problem?

Boris



More information about the odb-users mailing list