dlls containing functions with same names problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stenasc@yahoo.com

    dlls containing functions with same names problems

    Hi,

    I have created an C based application in linux that uses a number of
    dlls. Within the dlls themselves, the code calls sub functions e.g

    dll_1 (Main dll function is called Return_Answer. The code within the
    Return_Answer function called another function called Timer which is
    in dll_1)

    dll2 (Main dll function is called Calculate_Best_ Result. The code
    within the Calculate_Best_ Result function called another function
    called Timer which is in dll_2)

    The Timer functions in each dll are completely different. However,
    when I debug dll_1 in gdb, and am stepping through the code, I see
    that it jumps to the dll_2 Timer function instead of it's own.

    Anyone got any ideas. I have the same code working fine in MSVC. Never
    had a problem with it. The commands, I use to compile and link to the
    main executable are...

    gcc -ggdb -c -fPIC dll_1.c
    gcc -ggdb -shared -o libdll_1.so dll_1.o

    gcc -ggdb -c -fPIC dll_2.c
    gcc -ggdb -shared -o libdll_2.so dll_2.o

    The main code file is called test.c

    gcc -ggdb -c test.c
    gcc -o test -lm test.o -L. -ldll_1 -ldll_2 -ldl

    Everything compiles and links fine, so I am at a loss. Any help is
    much appreciated.

    Regards
    Bob

  • Chris Dollin

    #2
    Re: dlls containing functions with same names problems

    stenasc@yahoo.c om wrote:
    I have created an C based application in linux that uses a number of
    dlls. Within the dlls themselves, the code calls sub functions e.g
    dll's aren't part of C; they're an OS-specific extension.

    I'd start in comp.unix.progr ammer.

    --
    Chris "surely you /expect/ problems with a two-Timer?" Dollin

    Hewlett-Packard Limited registered no:
    registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

    Comment

    • Richard Heathfield

      #3
      Re: dlls containing functions with same names problems

      Roberto Waltman said:

      <snip>
      (a) Under windows, (at least Windows-CE, which my employer is now
      inflicting upon me,) a C function in a library in not visible to
      outside code unless it is explicitly exported.
      How strange. I've written quite a few programs under Windows that can
      call C functions in libraries just fine, without their being explicitly
      exported. Perhaps this is a Wince-only phenomenon, and perhaps you're
      simply mistaken, or perhaps I'm misinterpreting your statement, or
      perhaps my memory is shot to pieces and I'm wrong, or perhaps there's
      some other explanation. How to find out the truth? Ask in a Windows
      programming group, that's how.

      --
      Richard Heathfield <http://www.cpax.org.uk >
      Email: -www. +rjh@
      Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
      "Usenet is a strange place" - dmr 29 July 1999

      Comment

      • CBFalconer

        #4
        Re: dlls containing functions with same names problems

        stenasc@yahoo.c om wrote:
        >
        I have created an C based application in linux that uses a number of
        dlls. Within the dlls themselves, the code calls sub functions e.g
        >
        dll_1 (Main dll function is called Return_Answer. The code within the
        Return_Answer function called another function called Timer which is
        in dll_1)
        >
        dll2 (Main dll function is called Calculate_Best_ Result. The code
        within the Calculate_Best_ Result function called another function
        called Timer which is in dll_2)
        >
        The Timer functions in each dll are completely different. However,
        when I debug dll_1 in gdb, and am stepping through the code, I see
        that it jumps to the dll_2 Timer function instead of it's own.
        >
        Anyone got any ideas. I have the same code working fine in MSVC. Never
        had a problem with it. The commands, I use to compile and link to the
        main executable are...
        Make the functions static.

        --
        <http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
        <http://www.securityfoc us.com/columnists/423>
        <http://www.aaxnet.com/editor/edit043.html>
        cbfalconer at maineline dot net



        --
        Posted via a free Usenet account from http://www.teranews.com

        Comment

        Working...