×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    USER-42 Panic when delete Polymorphic DLL Object.

    Hi

    I am getting panic USER-42 When delete object of Polymorphic DLL.

    I am make boject in following way.

    // Load dll
    User::LeaveIfError(iLibrary.Load(_L("DLLExample")));

    // Find exported function
    TLibraryFunction NewL=iLibrary.Lookup(1);
    iCallDll = (MPlayerUIListener*) NewL();

    Code:
    VRexEngine.h
    =============
    #include <DLLExample.h>
    class MPlayerUIListener;
    
    private: 
    RLibrary iLibrary;
    
    public:
    MPlayerUIListener* iCallDll;
    
    VRexEngine.cpp
    ================
    CVRexAVView::~CVRexAVView()
        {
        if (iCallDll != NULL)
        	{
            delete iCallDll; //USER-42 getting here
        	iCallDll = NULL;
    
        	iLibrary.Close();
        	}
    }
    
    DLLExample Code
    -----------------
    EXPORT_C MPlayerUIListener* CDLLExample::NewL()
    	{
    	//CFileLogger::WriteLogL(_L("DLL-NewL"));
    	return new CDLLExample();
    	}
    
    // note, CBase initialises all member variables to zero
    CDLLExample::CDLLExample()
    	{
    	
    	}
    Regards,
    SymbianTH
    Last edited by SymbianTH; 2009-10-05 at 13:34.

  2. #2
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    Re: USER-42 Panic when delete Polymorphic DLL Object.

    Hi

    I am getting reference from following link.
    http://wiki.urban.cens.ucla.edu/inde...LLs_on_Symbian

    I make change that make global variable of DLL.
    Like in following way as per above link example.

    H
    ==
    public:
    MMathFunc* mf;

    CPP
    ====
    void abc::function()
    {
    RLibrary library;
    User::LeaveIfError(library.Load(_L("Square")));
    TLibraryFunction NewL=library.Lookup(1);
    mf=(MMathFunc*) NewL(); //MMathFunc* mf=(MMathFunc*) NewL();

    // be sure to close the library when you are done loading dlls
    library.Close();

    //use the object created by the dll
    TReal r = 2.0;
    r = mf->Apply(r);
    }

    abc::~abc()
    {
    delete mf;
    }

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: USER-42 Panic when delete Polymorphic DLL Object.

    From your code snippet MPlayerUIListener does not seem to be the "real" class, it would rather be CDLLExample. Thus the pointer to MPlayerUIListener points somewhere inside the object (CDLLExample), and not at the beginning of it (which would be the address of correct "cell" for delete).

    The referred example is not a nice one, that is why it may work. However your own code seems to be better Symbian code (most probably you have correct C and M-classes), and that is why the address of the "real" object and the address of the "M-object" differs.
    You can find polymorphic .dll example in the SDK too: Examples\Base\DLLs
    Last edited by wizard_hu_; 2009-10-05 at 14:17.

  4. #4
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    Re: USER-42 Panic when delete Polymorphic DLL Object.

    Quote Originally Posted by wizard_hu_ View Post
    From your code snippet MPlayerUIListener does not seem to be the "real" class, it would rather be CDLLExample. Thus the pointer to MPlayerUIListener points somewhere inside the object (CDLLExample), and not at the beginning of it (which would be the address of correct "cell" for delete).

    The referred example is not a nice one, that is why it may work. However your own code seems to be better Symbian code (most probably you have correct C and M-classes), and that is why the address of the "real" object and the address of the "M-object" differs.
    You can find polymorphic .dll example in the SDK too: Examples\Base\DLLs
    Hi

    I show and learn these examples but in these examples :- .EXE class implemented in DLL and .EXE's header file include in DLL.

    When I want to call DLL functions without dependent of exe means one DLL able to use in every EXE without make any change in DLL. Because I want to use this DLL with Python also.

    So any way that I want to use DLL function in EXE application and also able to import in PyS60? Please help me.

    Regards,
    SymbianTH

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: USER-42 Panic when delete Polymorphic DLL Object.

    For the Python part, I do not know.

    For the "exe class" in dll / vice versa stuff: that is just a matter of the organization of the example. If you want, you can freely copy UsingDLLs.h into the PolymorphicDLLx directories, and use them "locally" (you can remove "USERINCLUDE ..\UsingDLLs" from the .mmp in this case).

  6. #6
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    Re: USER-42 Panic when delete Polymorphic DLL Object.

    Quote Originally Posted by wizard_hu_ View Post
    For the Python part, I do not know.

    For the "exe class" in dll / vice versa stuff: that is just a matter of the organization of the example. If you want, you can freely copy UsingDLLs.h into the PolymorphicDLLx directories, and use them "locally" (you can remove "USERINCLUDE ..\UsingDLLs" from the .mmp in this case).
    Hi

    Thanks for Fast reply.

    I will check out this way and I will post here again after comes some result.

    Thanking You
    SymbianTH

  7. #7
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    442

    Re: USER-42 Panic when delete Polymorphic DLL Object.

    Quote Originally Posted by wizard_hu_ View Post
    For the Python part, I do not know.

    For the "exe class" in dll / vice versa stuff: that is just a matter of the organization of the example. If you want, you can freely copy UsingDLLs.h into the PolymorphicDLLx directories, and use them "locally" (you can remove "USERINCLUDE ..\UsingDLLs" from the .mmp in this case).
    Hi

    Thanks wizard_hu_
    yes It works. I copy UsingDLLs.h in PolymorphicDLL1 do work perfectly.

    Thank you again.
    SymbianTH

Similar Threads

  1. Replies: 9
    Last Post: 2009-08-06, 17:58
  2. strange User 42 panic
    By sandy_zeng in forum Symbian
    Replies: 1
    Last Post: 2007-08-07, 22:03
  3. Replies: 2
    Last Post: 2004-09-15, 22:47
  4. what happens to TLS when DLL is unloaded?
    By rtillitt in forum Symbian
    Replies: 1
    Last Post: 2002-11-27, 12:11
  5. Panic USER 42 - Please Help !!!
    By yuvalgeva in forum Symbian
    Replies: 2
    Last Post: 2002-05-21, 07:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×