By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,823 Members | 730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,823 IT Pros & Developers. It's quick & easy.

OO4O usage in a VC++ 6 DLL ?

P: n/a
Hi,

I'm just starting to use OO4O on a project and I do not know a lot
about Oracle.

I wrote a standard Windows DLL using VC++ 6.
In this DLL, I have a database class (DbOO4OClass) that use OO4O.

The DLL contains Startup and Shutdown functions that are called by the
application to do the OStartup and OShutdown calls.

When a DbOO4OClass instance is created, it creates one ODatabase and
one ODynaset objects (using new) that are used later in the class
methods to access the database.

aPtrConnection = new ODatabase;
aPtrRecordset = new ODynaset;
When the DbOO4OClass instance is destroyed, the destructor deletes the
ODatabase and ODynaset.

if( aPtrRecordset != NULL )
{
aPtrRecordset->Close();

// ****** memory problem when calling delete
delete aPtrRecordset;
aPtrRecordset = NULL;
}

if( aPtrConnection != NULL )
{
aPtrConnection->Close();
delete aPtrConnection;
aPtrConnection = NULL;
}

The problem is that when the aPtrRecordset object is deleted, there is
a memory exception. If I remove the delete, VC++ tells me that there
is a memory leak.
Everything else in the class works well (queries, calling stored
procs, etc...)

The same kind of memory error occurs in code like this:

for( int index = 0; index < fieldCount; index++ )
{
OField field = fields.GetField( index );

// do something with field
}

When the OField object is deleted at the end of the for loop, there is
a memory error.

When I follow the code in the disassembly window, the error seems to
be in the Oracle object destructor.
Is there something specific to do when using OO4O in a DLL?

Is it because the DbOo4OClass instance is created in the application
context and OO4O calls done in the DLL context?

Something else I missed?

Thanks for your help !
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.