[odb-users] Compiling ODB with /MTd

Boris Kolpackov boris at codesynthesis.com
Fri Mar 14 09:27:27 EDT 2014


Hi Erez,

Erez GB <erezgb at walla.com> writes:

> The libodb-sqlite-vc11 project you provide is compiling /MDd in
> debug (linking to DLL), however our program is compiling /MTd
> (statically linked).
>
> Although the libodb-sqlite-vc11 does compile  /MTd, when executing
> an erase query on our program we get debug heap corruption assert,
> this seems to be related to the std::string destructor.

I assume you are still linking to libodb-sqlite DLL. If that's
the case, then what you have is your application and libodb-sqlite
(and libodb) all using their own copy of the C runtime heap. As
a result, when code in, say, libodb-sqlite returns std::string
to your application code that is later release there, your
application will try to free the memory that was allocated on
libodb-sqlite's heap as if it were allocated on your application's
heap. That obviously doesn't end well.

If you want to use /MTd, all of your application should be
statically linked, including libodb and libodb-sqlite. There
are no static library configurations in ODB project files
yet so you will have to create them yourself (shouldn't
be too difficult).

Boris



More information about the odb-users mailing list