OO4O usage in a VC++ 6 DLL ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shamel

    #1

    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 !
Working...