×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    11

    Question Error:When Exported function of dynamically loaded DLL is called

    HI,

    I am working on S60 SDK 3rd FP1
    I am loading a DLL dynamically using Rlibrary::Load() API in a console application. DLL gets loaded without error.
    I got the pointer of the NewL() present in DLL using RLibrary::LookUp().

    But When I call that function, application is exiting with error " Exit type 2,3, KERN-EXEC".

    PLease provide any work around for this probelm.

    DLL has ALL capability, application has Local Services capability

    Code is as follows:


    RLibrary lib;
    RBusDevComm idevcom; //dummy
    CSTLC2500 *icstlc2500;
    _LIT(STBtDriver,"stlc2500.dll");
    if (!lib.Load(STBtDriver))
    console->Printf(_L("STLC2500 loaded"));
    else
    console->Printf(_L("STLC2500 not loaded"));
    TLibraryFunction entry=lib.Lookup(4);
    typedef CSTLC2500* (*Tstlc2500newl) (RBusDevComm&);
    Tstlc2500newl newl = reinterpret_cast<Tstlc2500newl>(entry);
    icstlc2500 = newl(idevcom);
    console->Printf(_L("Newl returned"));


    Thanks in Advance
    Chandru

  2. #2
    Super Contributor
    Join Date
    Oct 2005
    Posts
    739

    Re: Error:When Exported function of dynamically loaded DLL is called

    Please avoid multiple posting.....

    http://discussion.forum.nokia.com/fo...d.php?t=113097

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    11

    Re: Error:When Exported function of dynamically loaded DLL is called

    I did not mean to post multiple times... It was accidental... I had clicked Cancel twice .. but It got posted then also... I will be careful in future

    thanks

  4. #4
    Super Contributor
    Join Date
    Nov 2005
    Location
    London
    Posts
    584

    Re: Error:When Exported function of dynamically loaded DLL is called

    Have you stepped through the code in the debugger to find the point of the panic?

    I have a couple of comments on your code:

    Firstly, when you check whether library loading has been successful, it's better to check to see if the return value is KErrNone or a Symbian error code (see http://www.symbian.com/developer/tec...%3a%3aRLibrary for documentation of the return values).

    And you don't test that the return from the Lookup() call is valid. That is:

    TLibraryFunction entry=lib.Lookup(4);

    Should test that entry!=NULL

    There are lots of reasons for a KERN EXEC 3, but dereferencing NULL is among the most common: http://www.symbian.com/developer/tec...%2ekern%2dexec

    Additionally, if it is valid, is the value you're passing the function valid (idevcom) and is that method the correct one for what you expect at ordinal 4?

Similar Threads

  1. Replies: 2
    Last Post: 2004-11-17, 00:46
  2. Lib file VS. DLL file
    By zhang_guoqing in forum Symbian C++
    Replies: 0
    Last Post: 2004-07-24, 13:09
  3. Replies: 1
    Last Post: 2004-04-15, 14:57
  4. Cannot compile SDK's examples for 7650 platform...
    By midletsoft in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-08-12, 19:11
  5. Problem with Nokia D211 Linux Drivers
    By fiveam in forum Multimodecards
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

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