2 Replies Latest reply: Nov 13, 2007 5:03 AM by 608219 RSS

    Access violation - simple MFC app

    254992
      Using VS2005, I created a simple VC++ MFC SDI application. In my test code, I create an OraSession object just to see if OO4O is on the machine. So I create an object and then set it to NULL. When I exit the app, I get an Access violation reading location 0xfeeefeee.

      I don't think this should be happening. Can someone give me an explanation or a workaround? I did not get the access violation when creating a similar VS 6.0 project.

      The same steps do not The following are the steps I performed:

      Create new C++ project in VS2005:
      File > New > Project...
      Visual C++ > MFC > MFC Application
      Name = MfcApp
      Application Type > Single document
      Advanced Features > Automation
      Finish

      Make VS2005 break on access violation:
      Debug > Exceptions > Win32 Exceptions > c0000005 Access Violation

      Add code to create OraSession:
      o Open MainFrm.cpp
      o Added following at top
      #import "D:\\oracle\\product\\10.2.0\\client_1\\BIN\\Oip10.tlb" no_namespace rename( "EOF", "OipEOF" )

      o Added the following right before the 'return 0' in CMainFrame::OnCreate

           /*********************************************************************/
           /*********************************************************************/
           /*********************************************************************/
           // Create an OraSession object
           // Just creating this object causes a failure when exiting
           OraSessionPtr     pOraSession( __uuidof( OraSessionClass ) );
           // We're done with him
           pOraSession = NULL;
           /*********************************************************************/
           /*********************************************************************/
           /*********************************************************************/

      o Run the app in debug within VS2005 and exit the app. You will see the AV.

      Thanks,
      Tim