FUNC LOCL entries in nm

Discussion in 'C Programming' started by Merrill Lane, Jul 10, 2003.

  1. Merrill Lane

    Merrill Lane Guest

    Hi,

    I am attempting to link an object file and a shared library into an executable.
    My object file makes calls to two functions in the shared library (MY_FUNC1
    and MY_FUNC2).

    I am seeing the following error:

    ==> cc -o MY_EXECUTABLE MY_OBJECTFILE -L. -R. -lMY_SHARED_LIBRARY
    Undefined first referenced
    symbol in file
    MY_FUNC1 MY_OBJECTFILE
    ld: fatal: Symbol referencing errors. No output written to
    MY_EXECUTABLE

    When I do an "nm" on the shared library, grepping for the functions I use,
    I get:


    [...] | ...| ...|FUNC |LOCL |2 |10 |MY_FUNC1
    [...] | ...| ...|FUNC |GLOB |0 |10 |MY_FUNC2

    So it makes sense that I got the linker error because MY_FUNC1 is
    LOCL. However, both functions have prototypes in the same public header file,
    with the same storage modifiers (extern). Neither of the functions is static.
    So, my question is, why is MY_FUNC1 made into a LOCL function, unusable by
    by my executable (while MY_FUNC2 is GLOB and usable by my executable).

    Any thoughts would be appreciated.

    Thanks,
    Merrill
     
    Merrill Lane, Jul 10, 2003
    #1
    1. Advertising

  2. Merrill Lane

    Artie Gold Guest

    [OT] Re: FUNC LOCL entries in nm

    Merrill Lane wrote:
    > Hi,
    >
    > I am attempting to link an object file and a shared library into an executable.
    > My object file makes calls to two functions in the shared library (MY_FUNC1
    > and MY_FUNC2).
    >
    > I am seeing the following error:
    >
    > ==> cc -o MY_EXECUTABLE MY_OBJECTFILE -L. -R. -lMY_SHARED_LIBRARY
    > Undefined first referenced
    > symbol in file
    > MY_FUNC1 MY_OBJECTFILE
    > ld: fatal: Symbol referencing errors. No output written to
    > MY_EXECUTABLE
    >
    > When I do an "nm" on the shared library, grepping for the functions I use,
    > I get:
    >
    >
    > [...] | ...| ...|FUNC |LOCL |2 |10 |MY_FUNC1
    > [...] | ...| ...|FUNC |GLOB |0 |10 |MY_FUNC2
    >
    > So it makes sense that I got the linker error because MY_FUNC1 is
    > LOCL. However, both functions have prototypes in the same public header file,
    > with the same storage modifiers (extern). Neither of the functions is static.
    > So, my question is, why is MY_FUNC1 made into a LOCL function, unusable by
    > by my executable (while MY_FUNC2 is GLOB and usable by my executable).
    >
    > Any thoughts would be appreciated.
    >


    Your question is off topic for news:comp.lang.c, as it has to do with a
    particular compiler/linker as opposed to the language itself. The C
    standard is silent about how libraries work.

    This question would be appropriate in a compiler- or platform-specific
    forum.

    <OT>
    My SWAG is that MY_FUNC1 has been made local through the use of a linker
    script -- and that the header is somehow out of sync with the actual
    library. Short of rebuilding the library (or somehow massaging it)
    there's nothing you can do.
    </OT>

    HTH,
    --ag


    --
    Artie Gold -- Austin, Texas
     
    Artie Gold, Jul 10, 2003
    #2
    1. Advertising

  3. On 10 Jul 2003 14:33:55 -0700, in comp.lang.c ,
    (Merrill Lane) wrote:

    >Hi,
    >
    >I am attempting to link an object file and a shared library into an executable.

    <snip>
    >Any thoughts would be appreciated.


    You are asking about how to link modules. Thats nothing to do with C,
    but to do with your implementation. You need to ask in a more
    appropriate group,. perhaps one specialising in whatever compiler you
    use.
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
     
    Mark McIntyre, Jul 11, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CRON
    Replies:
    24
    Views:
    200,850
    Adrienne Boswell
    Jun 20, 2006
  2. Johnny
    Replies:
    3
    Views:
    462
    Robert Kern
    Aug 23, 2005
  3. Hari Sekhon
    Replies:
    0
    Views:
    514
    Hari Sekhon
    Jun 20, 2006
  4. Vinko Vrsalovic

    int func() v/s int func(void)

    Vinko Vrsalovic, Jan 21, 2005, in forum: C Programming
    Replies:
    14
    Views:
    1,321
    Villy Kruse
    Jan 24, 2005
  5. Alex Vinokur
    Replies:
    6
    Views:
    361
    Tor Rustad
    Nov 18, 2006
Loading...

Share This Page