[odb-users] Executable crash when I link libodb and libodb-mysql statically (VS2015)

Dev Programmer devpro2k19 at gmail.com
Tue Mar 19 08:33:05 EDT 2019


Hello

I played with my test project that I copied from "hello" example in my
Visual Studio 2015.
I built it, and executed. With DLLs It worked!

After I tried to build odb and odm-mysql statically with my test project.

In project libodb I changed target to static library and add preprocessor
definition LIBODB_STATIC_LIB

In project libodb-mysql I changed target to static library as well and add
preprocessor definition LIBODB_STATIC_LIB
LIBODB_MYSQL_STATIC_LIB

In my test project I added directives LIBODB_STATIC_LIB
LIBODB_MYSQL_STATIC_LIB as well. Project was build, but when I try to
execute program It was crashed.

int main(int argc, char* argv[])
{
try
{
                // IT CRASHED HERE
auto_ptr<database> db(new odb::mysql::database(argc, argv));

unsigned long john_id, jane_id, joe_id;

// Create a few persistent person objects.
//
{
person john("John", "Doe", 33);
person jane("Jane", "Doe", 32);
person joe("Joe", "Dirt", 30);

transaction t(db->begin());

// Make objects persistent and save their ids for later use.
//
john_id = db->persist(john);
jane_id = db->persist(jane);
joe_id = db->persist(joe);

t.commit();
}
}
catch (const odb::exception& e)
{
cerr << e.what() << endl;
return 1;
}
    return 0;
}

I have no idea why it happen.
If anybody know where I made a misstake, please, let me know.
Thank you.


More information about the odb-users mailing list