Thread: Losing reference between dlls

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476

    Losing reference between dlls

    Hi guys. I've got a weird situation that I don't know how to handle. You see, I'm using a few dinamically linked libraries and I don't know why but the memory reference for a variable in another dll was lost. And it caused an unhandled exception. To illustrate my problem, I'll try to write a short version of it.

    Consider I have this class in my main program (MyApp.exe):
    Code:
    MyDllClass1 gMyDll1;
    
    class MyApp
    {
    
    
       public:
    ...
          void create();
    
    }
    
    //Method definition
    void MyApp::create()
    {
    ...
          gMyDll1 = new MyDll();
          gMyDll1->create(); //exception here. it calls the methods that is defined inside a dll called MyDll.dll
    ...
    }
    When I debugged it and traced it inside the MyApp::create(), I found that mMyDll1 was initialized correctly. But when I traced into MyDll::create(), I found out that the this pointer of gMyDll1 object was null (thus the exception). How can this possible? I'm quite sure that the mMyDll1 wasn't deleted.

    Can anybody help me here? Thanks a lot in advance.
    Last edited by g4j31a5; 05-17-2010 at 07:47 AM.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM