[odb-users] Using ODB from DLL on Windows XP
Leo_Ashkinaziy at symantec.com
Wed Jun 29 19:53:11 EDT 2016
Thank you for replying. Yes, I did rebuild everything. Just to be sure this morning I downloaded new libodb, libodb-sqlite, and libodb-boost and rebuilt from scratch. I had to make the following changes to the solutions in the zip:
* Change platform toolset to Visual Studio 2013 - Windows XP (v120_xp)
* Change configuration type to static library
* Change preprocessor defines where appropriate to LIBODB_SQLITE_STATIC_LIB, LIBODB_BOOST_STATIC_LIB, and LIBODB_STATIC_LIB
With the rebuilt ODB libraries and the change in config-vc.h I see the same crash on my Windows 7 machine. I have not tried on Windows XP. Since it was local I ran it from Visual Studio so I could get the call stack and the crash details:
Unhandled exception at 0x7728E6DF (ntdll.dll) in ConsoleApp.exe: 0xC0000005: Access violation writing location 0x00000014.
ConsoleApp.exe!odb::details::win32_lock::win32_lock(_RTL_CRITICAL_SECTION & cs) Line 23 C++
ConsoleApp.exe!odb::details::win32_once(unsigned int & o, void (void) * func) Line 14 C++
ConsoleApp.exe!odb::details::tls<odb::transaction *>::get() Line 76 C++
ConsoleApp.exe!odb::details::tls_get<odb::transaction>(const odb::details::tls<odb::transaction *> & t) Line 104 C++
ConsoleApp.exe!odb::transaction::reset(odb::transaction_impl * impl, bool make_current) Line 39 C++
ConsoleApp.exe!odb::transaction::transaction(odb::transaction_impl * impl, bool make_current) Line 26 C++
ConsoleApp.exe!CreateDatabase(std::shared_ptr<odb::sqlite::database> spDb) Line 39 C++
ConsoleApp.exe!main(int argc, char * * argv) Line 18 C++
ConsoleApp.exe!__tmainCRTStartup() Line 255 C
ConsoleApp.exe!mainCRTStartup() Line 165 C
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: Tuesday, June 28, 2016 11:33 PM
To: Leo Ashkinaziy <Leo_Ashkinaziy at symantec.com>
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Using ODB from DLL on Windows XP
Leo Ashkinaziy <Leo_Ashkinaziy at symantec.com> writes:
> The solution in that thread seemed to comment out "#define
> ODB_THREADS_TLS_DECLSPEC" in odb\details\config-vc.h and rebuild ODB.
> It did not work for me when I tried it, and actually caused crashes on
> other OS as well. Is there anything else to be tried?
Did you rebuild everything ODB-related after making this change? In particular, you need to rebuild libodb-sqlite (and any other libodb* library you may be using) as well as every project that links to anything ODB-related. The only thing you don't need to rebuild is the ODB compiler.
More information about the odb-users