How to call different functions with the same name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lanser

    How to call different functions with the same name

    Hi Gurus,

    I have two libraries, called libA and libB and I will create a driver
    placed between them, look like following:
    libA
    |
    driver
    |
    libB
    There is a function reference in libA, named foo, so I should
    implement it in driver.
    But libB has also a function called foo implemented, and I can't let
    libA call the foo in libB directly.
    Since I compiled by GCC, I try to weaken the foo in libB and provide a
    global foo in driver to be linked with libA.
    The question is: to implement foo in driver, I have to call the foo in
    libB for its functional, how can I do this???
    I tried alias, but it doesn't work. libA always called the foo in libB
    instead which in driver.

    Any suggestion?
  • Jack Klein

    #2
    Re: How to call different functions with the same name

    On Mon, 10 Nov 2008 18:34:09 -0800 (PST), lanser <Lanser.Z@gmail .com>
    wrote in comp.lang.c:
    Hi Gurus,
    >
    I have two libraries, called libA and libB and I will create a driver
    placed between them, look like following:
    libA
    |
    driver
    |
    libB
    There is a function reference in libA, named foo, so I should
    implement it in driver.
    But libB has also a function called foo implemented, and I can't let
    libA call the foo in libB directly.
    Since I compiled by GCC, I try to weaken the foo in libB and provide a
    global foo in driver to be linked with libA.
    The question is: to implement foo in driver, I have to call the foo in
    libB for its functional, how can I do this???
    I tried alias, but it doesn't work. libA always called the foo in libB
    instead which in driver.
    >
    Any suggestion?
    There is nothing in the C language that allows two functions with
    external linkage to exist in the same program. gcc might offer
    something that can do what you want, but it is a non-standard
    extension and not part of the language.

    So try asking in one of the gnu.gcc.* groups.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    alt.comp.lang.l earn.c-c++

    Comment

    Working...