[odb-users] Question on Using ODB within a DLL
thomas.szumowski at lmco.com
Thu Jun 23 19:39:11 EDT 2011
I am interested in creating an DLL. Within that DLL I'd like to create a database and make ODB transactions. I have code that operates perfectly when it is an executable, but when I turn it into a DLL and call from an external program, I get ODB related errors.
The dialog error indicates a null pointer:
Unhandled exception at 0x0039fa4a (odb-d-1.4-vc10.dll) in dbtest.exe
0xC0000005: Access violation reading location 0x00000000.
When I trace through the code, the error occurs during the create_database call (where argc and argv are valid and passed through to the DLL as function prototypes):
auto_ptr<database> db (create_database(argc, argv));
And the null pointer exception occurs in the return line of transaction::current() in transaction.cxx:
return tls_get (current_transaction) != 0;
First, is it possible to access the ODB library from a developed DLL?
Second, if so, are there specifics in the setup, or any suggestions as to why this null pointer exception may be occurring in a DLL but not as an EXE?
Thank you again.
More information about the odb-users