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 days ago: http://www.codesynthesis.com/pipermail/odb-users/2013-May/001286.html Because your application doesn't directly reference any symbols from library-odb.cxx, the linker ignores library-odb.o from library.a. As a result the schema creation code does not end up in the executable. Normally this is not a problem since most application executables will also include code that persists objects, etc., which will force the linker to include all the object files from the library. In your test, however, all you do is create the schema. As mentioned in the above email, with GNU ld you can use the --whole-archive option to force the linker to include every object file from your static library: > $ g++ -o test2 main.o library.a -lodb-sqlite -lodb g++ -o test2 main.o -Wl,-whole-archive library.a -Wl,-no-whole-archive -lodb-sqlite -lodb Another thing that you may find useful is the 'separate' value for the --schema-format option. It will trigger the generation of the schema creation code as a separate C++ source file (library-schema.cxx). You can then perhaps link it directly to your executable instead of packaging it into a static library. See the ODB compiler command line documentation (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
分类:
DataBase
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!