[odb-users] Problem - Using ODB inside a DLL

Cuong Minh Tran vaioinman at googlemail.com
Fri Dec 9 18:13:47 EST 2011


Hi everyone,

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
         …

The Output has these lines:
...
GME.exe': Loaded 'C:\Program Files\GME\Bin\odb-mysql-1.6-vc10.dll', Symbols loaded.
'GME.exe': Loaded 'C:\Program Files\GME\Bin\libmysql.dll', Exports loaded.
'GME.exe': Loaded 'C:\WINDOWS\system32\mfc100.dll', Cannot find or open the PDB file
'GME.exe': Loaded 'C:\WINDOWS\system32\dnsapi.dll', Exports loaded.
'GME.exe': Loaded 'C:\WINDOWS\system32\iphlpapi.dll', Exports loaded.
'GME.exe': Loaded 'C:\WINDOWS\system32\winrnr.dll', Exports loaded.
'GME.exe': Loaded 'C:\WINDOWS\system32\wshbth.dll', Exports loaded.
'GME.exe': Loaded 'C:\WINDOWS\system32\rasadhlp.dll', Exports loaded.
The thread 'RtlAllocateHeap' (0x260) has exited with code 0 (0x0).
The thread 'RtlAllocateHeap' (0xc60) has exited with code 0 (0x0).
First-chance exception at 0x03435937 (odb-1.6-vc10.dll) in GME.exe: 0xC0000005: Access violation reading location 0x00000000.
The thread 'RPC Callback Thread' (0xe04) has exited with code 0 (0x0).
The thread 'WmiFreeBuffer' (0xc90) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x954) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x670) has exited with code 0 (0x0).

The Disassembly has these lines:
 			std::auto_ptr<odb::database> db ( create_database ( ) );
 lea         edx,[ebp-1ACh]  
 push        edx  
 call        create_database (451EFD0h)  
 mov         esi,dword ptr [eax]  
 add         esp,4  
 mov         dword ptr [eax],0  
 mov         dword ptr [ebp-1CCh],esi  
 mov         ecx,dword ptr [ebp-1ACh]  
 mov         bl,63h  
 mov         byte ptr [ebp-4],bl  
 test        ecx,ecx  
 je          04523116  
 mov         eax,dword ptr [ecx]  
 mov         edx,dword ptr [eax]  
 push        1  
 call        edx  

				odb::transaction t (db->begin ());
 mov         eax,dword ptr [esi]  
 mov         edx,dword ptr [eax+4]  
 mov         ecx,esi  
 call        edx  
 push        1  
 push        eax  
 lea         ecx,[ebp-284h]  
 call        dword ptr [__imp_odb::transaction::transaction (46675A4h)]  

It looks like libodb could have an issue some where. Could someone please offer some help?

Many thanks and best regards,

Cuong Tran

PS. I tried the libodb and libodb-sqlite 1.6 in a standalone command line MSVC application and they worked fine.


More information about the odb-users mailing list