This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in GCC or Linking shared library


> This is a basic feature of C, it has nothing to do with GCC all C
> compilers work this way.
>
> The function foo() is compiled to a symbol called "foo".
>
> The function foo(Y, double) is compiled to a symbol called "foo"
>
> When you call foo('c') the compiler creates a reference to a symbol
> called "foo".  The linker resolves that reference by finding a symbol
> called "foo". The first symbol called "foo" it finds gets used.  The
> linker doesn't know or care what arguments your function takes, it
> just sees a symbol called "foo" and it uses it.
>
>
Thanks for clear explanation, now I understand why liby.so api called
and not libx.so api.

The fix I'm currently testing is by setting attribute to function, by
setting visibility to "internal" it seems working for me. Is there any
reason I should not use this option,
http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html


;)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]