Dynamic libs and undefined references

This is a discussion on Dynamic libs and undefined references within the C Programming forums, part of the General Programming Boards category; Hi, I am learning to use dynamic libraries. I thought that it was possible to compile a program with shared ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    14

    Question Dynamic libs and undefined references

    Hi,

    I am learning to use dynamic libraries. I thought that it was possible to compile a program with shared libs in which all references are not defined, so that you can load other shared libs with dlopen to define the references during the running of the code.

    Is it not the case? If it is, what are the linking options to be given to gcc and ld?

    Thanks,
    CCox

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can not LINK to a dynamic library that doesn't resolve all references your application needs.

    You can have load a dynamic library at runtime, which would allow you to request the pointer to a function inside the library at runtime. But you can't link to it.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    14
    OK, thanks for the answer.

    I had some progress with my program, but a new problem occured:
    My shared libs asks for symbols of my static libs, and I get "unresolved symbols". Yet I was thinking my linking was fine...

    Any idea for that?

    Best,
    CCox

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    1
    hi plz help me
    for int86 system programing

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,655
    Problem?
    Code:
    #include <ip.hpp>

  6. #6
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Quote Originally Posted by ccox421 View Post
    OK, thanks for the answer.

    I had some progress with my program, but a new problem occured:
    My shared libs asks for symbols of my static libs, and I get "unresolved symbols". Yet I was thinking my linking was fine...

    Any idea for that?

    Best,
    CCox
    Can you show more precisely how you are linking, how your code is organized, etc?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 05-11-2009, 07:56 PM
  2. Replies: 7
    Last Post: 02-01-2009, 03:53 PM
  3. MinGW Linking GUI Program
    By Tonto in forum Tech Board
    Replies: 19
    Last Post: 08-23-2006, 03:28 PM
  4. Eclipse - Palm - undefined reference to - Cygwin
    By gustavolaufer in forum C++ Programming
    Replies: 0
    Last Post: 03-02-2006, 06:33 AM
  5. undefined reference to `WSAStartup@8'
    By wicked in forum C Programming
    Replies: 26
    Last Post: 01-09-2005, 12:22 PM

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