×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 43
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    18

    Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Hi,

    [Edit: I'm using S60 v3 final SDK] If I have an executable that uses a DLL that links with estlib.lib, trying to start the executable causes a kernel fault:
    37.595 FAULT: nkern.cpp 00000025

    This happens at DLL loading phase, before any of my code even gets executed, more details below. Is there something that I should do to disable DLL startup code? The help mentions a "STDLIB" build target in passing but doesn't describe if/when/how it should be used. I can't find anything in release notes or FAQ either.

    The easiest way to reproduce this is to add a DLL using estlib.lib to helloworldbasic or another simple test application. You can find a pre-modified helloworldbasic example at:
    http://www.s2.org/~pekangas/hellowor...stdlib_dll.zip

    I've included the stack trace for the crash below. It suggests that the DLL startup code accidentally uses some Symbian LIBC functions instead of Carbide runtime methods, which causes a conflict maybe because it causes a trip back to the kernel? The three calls from inside my DLL are all from the runtime library:

    31 0x1E81FB58( puttyengine.dll )() => sysenv.win32.c.obj(___msl_putenv) + 0xd8
    30 0x1E81F963( puttyengine.dll )() => sysenv.win32.c.obj(_init_environ) + 0x53
    29 0x1E81F9F1( puttyengine.dll )() => sysenv.win32.c.obj(__SetupEnv) + 0x11
    28 0x1E81E2E2( puttyengine.dll )() => mwcrtdllmain.c.obj(__DllMainCRTStartup@12) + 0x72

    Full stack trace:

    43 0x86BA12( ekern.exe )()
    42 0x86BB61( ekern.exe )()
    41 0x89D794( ekern.exe )()
    40 0x89D709( ekern.exe )()
    39 0x861076( ekern.exe )()
    38 0x8613AC( ekern.exe )()
    37 0x8641EA( ekern.exe )()
    36 0x6002183D( euser.dll )()
    35 0x6004DFF2( euser.dll )()
    34 0x6004DE8E( euser.dll )()
    33 0x60016188( euser.dll )()
    32 0x4351EB42( ESTLIB.DLL )()
    31 0x1E81FB58( puttyengine.dll )()
    30 0x1E81F963( puttyengine.dll )()
    29 0x1E81F9F1( puttyengine.dll )()
    28 0x1E81E2E2( puttyengine.dll )()
    27 0x7C9011A7( ntdll.dll )()
    26 0x7C91CBAB( ntdll.dll )()
    25 0x7C916178( ntdll.dll )()
    24 0x7C9162DA( ntdll.dll )()
    23 0x7C801BB9( KERNEL32.dll )()
    22 0x7C80ACE4( KERNEL32.dll )()
    21 0x6A0024A7( emulator.dll )()
    20 0x871A51( ekern.exe )()
    19 0x887084( ekern.exe )()
    18 0x8A0E86( ekern.exe )()
    17 0x88A7F7( ekern.exe )()
    16 0x88A6BD( ekern.exe )()
    15 0x8642B5( ekern.exe )()
    14 0x86422B( ekern.exe )()
    13 0x62047EAD( efile.exe )()
    12 0x620186B0( efile.exe )()
    11 0x62017AFC( efile.exe )()
    10 0x60011576( euser.dll )()
    9 0x600028AF( euser.dll )()
    8 0x6000269A( euser.dll )()
    7 0x600024FA( euser.dll )()
    6 0x600023BB( euser.dll )()
    5 0x620152FC( efile.exe )()
    4 0x62049018( efile.exe )()
    3 0x86A6A2( ekern.exe )()
    2 0x868AD1( ekern.exe )()
    1 0x7C80B50B( KERNEL32.dll )()

    Any workarounds or fix possibilities? This essentially makes Carbide useless for developing software ported from other systems.


    Thanks,

    Petteri
    Last edited by pekangas; 2006-03-03 at 17:41.

  2. #2
    Nokia Developer Expert
    Join Date
    Oct 2004
    Location
    Austin, TX USA
    Posts
    271

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Thank you for this very detailed report. I'll work on reproducing this here and will let you know what I come up with.

    Regards,

    Matt P.

  3. #3
    Nokia Developer Expert
    Join Date
    Oct 2004
    Location
    Austin, TX USA
    Posts
    271

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    One quick question: does this same behavior happen with CodeWarrior, or is this new with Carbide?

    Matt P.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    18

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Hi,

    This doesn't happen with CodeWarrior, at least with version 3.1. When building form the command line I do get warnings that point to a conflict between the runtime library and estlib though:

    mwldsym2.exe: warning: Multiply defined section: _longjmp in
    mwldsym2.exe: warning: files setjmp.x86.c.obj (MSL_ALL_MSE_Symbian_D.lib), ESTLIB.dll (estlib.lib),
    mwldsym2.exe: warning: keeping definition in ESTLIB.dll

    And similar warnings for malloc() and other libc functions.

    The application still works though, so I guess either the DLL startup code doesn't get run or it for some reason doesn't cause problems with CW.


    Petteri

  5. #5
    Nokia Developer Expert
    Join Date
    Oct 2004
    Location
    Austin, TX USA
    Posts
    271

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Quick update: I am able to reproduce this problem with Carbide and I'm speaking to the linker engineer about it, but I don't have any info on whether there is a workaround yet.

    Matt P.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    18

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    I have a similar problem, resulting an unandled exception in the emulator, but with a different compilation warning. The test evironement is a DLL (polymorphic) loaded by an exe program.
    The DLL links to ESTLIB.LIB but doesn't link to EDLL.LIB, but the message show a reference to EDLL.LIB...

    All the DLL that I use link agaisnt ESTLIB.DLL but only a couple of them produce the warning and using it the emulator crash...

    Probably it depends by some particular stdlib functions used by the code.


    mwldsym2.exe: warning: Multiply defined symbol: void * operator new(unsigned int) (??2@YAPAXI@Z) in
    mwldsym2.exe: warning: files New.cpp.obj (MSL_All_MSE_Symbian_D.lib), uc_dll.obj (EDLL.LIB),
    mwldsym2.exe: warning: keeping definition in uc_dll.obj
    mwldsym2.exe: warning: Multiply defined symbol: void operator delete(void *) (??3@YAXPAX@Z) in
    mwldsym2.exe: warning: files New.cpp.obj (MSL_All_MSE_Symbian_D.lib), uc_dll.obj (EDLL.LIB),
    mwldsym2.exe: warning: keeping definition in uc_dll.obj

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    2

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    I am having similar problems, and am getting a Kernel Panic only if I build using Carbide.vs 2.0.1, no panics if I build it from Command Prompt.

    Any updates or workarounds?

  8. #8
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    81

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    I'm having the problem too. How do I set things up to build from the command line? If I try I simply get "ERROR: Unable to identify a valid CodeWarrior for Symbian OS installation"

    Thanks

  9. #9
    Super Contributor
    Join Date
    Sep 2004
    Posts
    1,048

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Content moved to correct thread.
    Last edited by mitts; 2006-04-05 at 08:52.

  10. #10
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    81

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    I think you have posted to the wrong thread! This thread is about linking against the Symbian C library, the other thread is about ECOM plugins

  11. #11
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    81

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Seems like Carbide already has a stdlib built-in, adding another one causes problems. Presumably you can just remove estlib for winscw builds and leave it in for arm builds?

  12. #12
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    144

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Hi,

    I am having the same problem here.

    But when I remove the estlib.lib from the mmp file, I cannot compile/link anymore due to undefined symbols.

    What should I do?

    Regards
    Max

  13. #13
    Super Contributor
    Join Date
    Sep 2004
    Posts
    1,048

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    From your comment it is not obvious which Carbide you refer to. For Carbide.vs, this has been tested to work for the 3.0 dll.

    You need to add one system include path and only link against euser.

    You have set up your project correctly if after the .mmp update in Carbide.vs you have in the dll .mmp file something like (but remember changes are done in the project properties, see Help):

    Code:
    SYSTEMINCLUDE                 \Epoc32\include\libc
    LIBRARY                             euser.lib
    This is a minimalistic .h/.c source sample - with "<" and ">" missing due to how the board seems to work

    Code:
    #ifndef __CTEST_H__
    #define __CTEST_H__
    
    #include e32def.h
    #include stdlib.h
    #include stdio.h
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    IMPORT_C int func();
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif  // __CTEST_H__
    Code:
    #include "ctest.h"
    
    EXPORT_C int func()
    {
    	int i = rand();
    	return 0x1337 + i;
    }

  14. #14
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    144

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Hi,

    yes, I am refering to the latest carbide.vs with 3rd edition final sdk.

    This is my project file:


    TARGET SyExpat.dll
    TARGETTYPE dll
    UID 0x1000008d 0xA00005B4
    macro HAVE_EXPAT_CONFIG_H XML_BUILDING_EXPAT
    USERINCLUDE ..\lib
    USERINCLUDE .
    SOURCEPATH .
    SOURCE SyExpat.cpp
    SOURCE SyGen.cpp

    SOURCEPATH ..\Lib
    SOURCE xmlparse.c
    SOURCE xmlrole.c
    SOURCE xmltok.c

    SYSTEMINCLUDE \epoc32\include\libc
    SYSTEMINCLUDE \Epoc32\include
    SYSTEMINCLUDE .
    SYSTEMINCLUDE ..\Lib
    LIBRARY euser.lib
    EXPORTUNFROZEN


    But then I get unresolved symbols and I cannot compile anymore.
    If I add estlib.lib to the project, I am able to compile, but get the above mentioned error when executing the application.

    Regards
    Max

  15. #15
    Super Contributor
    Join Date
    Sep 2004
    Posts
    1,048

    Re: Linking with a DLL using estlib.lib (a.k.a. stdlib or libc) causes a kernel fault

    Unresolved symbols are due to missing include files, those errors will not be solved by adding a lib. Find the missing #include to fix compile time errors.

Similar Threads

  1. Linking dll in S60 3rd edition - experts please help!
    By iulian_moldovan in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-06-13, 18:41
  2. Linking Static DLL with another Static DLL
    By symbianfresher in forum Symbian
    Replies: 6
    Last Post: 2006-01-09, 04:23

Posting Permissions

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