首页 > 代码库 > [odb-users] Create schema error (unknown database schema '')

[odb-users] Create schema error (unknown database schema '')

Boris Kolpackov boris at codesynthesis.com 
Fri May 31 11:13:02 EDT 2013

 

  • Previous message: [odb-users] Create schema error (unknown database schema ‘‘)
  • Next message: [odb-users] Create schema error (unknown database schema ‘‘)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Hi Andrey,Andrey Devyatka <an9bit at gmail.com> writes:> Please tell me, can I use the static library in the following case:>> [...]This is exactly the same issue that we‘ve discussed just a few daysago:http://www.codesynthesis.com/pipermail/odb-users/2013-May/001286.htmlBecause your application doesn‘t directly reference any symbols fromlibrary-odb.cxx, the linker ignores library-odb.o from library.a. Asa result the schema creation code does not end up in the executable.Normally this is not a problem since most application executableswill also include code that persists objects, etc., which willforce the linker to include all the object files from the library.In your test, however, all you do is create the schema. As mentionedin the above email, with GNU ld you can use the --whole-archiveoption to force the linker to include every object file from yourstatic library:> $ g++ -o test2 main.o library.a -lodb-sqlite -lodbg++ -o test2 main.o -Wl,-whole-archive library.a -Wl,-no-whole-archive -lodb-sqlite -lodbAnother thing that you may find useful is the ‘separate‘ value forthe --schema-format option. It will trigger the generation of theschema creation code as a separate C++ source file (library-schema.cxx).You can then perhaps link it directly to your executable instead ofpackaging it into a static library. See the ODB compiler command linedocumentation (man pages) for more information on this option.Boris

 

  • Previous message: [odb-users] Create schema error (unknown database schema ‘‘)
  • Next message: [odb-users] Create schema error (unknown database schema ‘‘)
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

from:http://www.codesynthesis.com/pipermail/odb-users/2013-May/001299.html

[odb-users] Create schema error (unknown database schema '')