static linking with Dev-c++/gcc

This is a discussion on static linking with Dev-c++/gcc within the C Programming forums, part of the General Programming Boards category; When I compile a C app with Dev-c++/gcc it dynamically links with msvcrt.dll. Is there is a way to link ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    167

    static linking with Dev-c++/gcc

    When I compile a C app with Dev-c++/gcc it dynamically links with msvcrt.dll. Is there is a way to link with a static c library?
    silk.odyssey

  2. #2
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    If you want to compile in a static way you have to use --static
    Maybe you are trying to avoid that kind of automatic linking between your program and the standar libraries, if you want to do that yo have to:
    "gcc --ffreestanding file.c"

  3. #3
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    The --static and --freestanding options doesn't seem to be helping because the program still links with msvcrt.dll.
    Last edited by silk.odyssey; 12-14-2003 at 04:56 AM.
    silk.odyssey

  4. #4
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    I do not program under a Windows environment but I have some expirience using gcc under DOS and NIX*

    The next piece of text is from the GCC Manual:


    Assert that compilation takes place in a freestanding environment. This implies -fno-builtin. A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at "main". The most obvious example is an OS kernel.

    So, you don't want to link againts that library, do you ? Why don't you explain me what are you wanna do ?

  5. #5
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    What i wanted to do was to statically link to the c standard library instead of msvcrt.dll.
    silk.odyssey

  6. #6
    Registered User
    Join Date
    Dec 2003
    Posts
    4
    Ok, but What Happend when you use --freestanding ?

    Do you get some error ?

  7. #7
    Registered User
    Join Date
    Dec 2003
    Posts
    167
    No I didn't get an error but it didn't change anything. The program still linked with msvcrt.dll.
    silk.odyssey

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 04:06 PM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 02:22 PM
  3. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 06:05 PM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  5. Linking errors with static var
    By Elysia in forum C++ Programming
    Replies: 8
    Last Post: 10-27-2007, 06:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21