[odb-users] Problem - Using ODB inside a DLL
Cuong Minh Tran
vaioinman at googlemail.com
Sun Dec 11 14:59:27 EST 2011
Great thanks to your reply. I will try your COM DLL project and communicate the progress.
Nonetheless, looking back through the archives, I found my problem to be very much like this:
But the archive does not seem to contain the solution.
On 11 Dec 2011, at 13:22, Boris Kolpackov wrote:
> Hi Cuong,
> Cuong Minh Tran <vaioinman at googlemail.com> writes:
>> I am trying to use the set ODB - MYSQL/SQLite version 1.6 in my COM DLL,
>> developed in MSVC 2010. I had no issues with compiling libodb,
>> libodb-mysql/sqlite on the same machine with my COM. My COM code also
>> compiles without a problem. However, I want to trigger the COM in my
>> application, the execution always fails at the (*) line:
>> // create database pointer
>> std::auto_ptr<odb::database> db ( create_database ( ) );
>> (*) odb::transaction t (db->begin ());
>> //persist an simple object
> It is hard to say what's going on without knowing exactly how you
> created your "COM DLL" and without seeing the create_database()
> database implementation. One fairly common cause would be if ODB
> is unable to connect to the database (which in this case will
> happen during the db->begin () call) though you said that
> everything works fine in plain Win32 setup so it is probably not
> In any case, I went ahead and created a test "COM DLL" project as
> described on this page:
> I then added code similar to the above to the property's get_XXX()
> function. However, everything is working fine for me. Could you try
> this project and see if it works for you?
> You will need to make some modifications in Object1.cpp to use
> your MySQL connection parameters before you can run the test.
> If it works for you as well, then you can try to modify it to
> resemble your code until it fails. Then I would be able to take
> a look.
More information about the odb-users