469,610 Members | 1,554 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

OO4O usage in a VC++ 6 DLL ?

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
0 737

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Julia Sats | last post: by
reply views Thread by shamel | last post: by
3 posts views Thread by Omid | last post: by
4 posts views Thread by Andrew Ward | last post: by
2 posts views Thread by Sticker | last post: by
reply views Thread by Mullai | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.