Re: Bug in GCC or Linking shared library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> It will be great help if somebody help me to fix this issue.
>
> What's the issue?
> You've described what happens, but not what you want to happen.
>
> If you just want the linker to determine the right function based only
> on the signature then you'll need to switch to use C++ instead of C,
> because then functions with different signatures have different linker
> symbols, and you could also use namespaces to distinguish functions in
> different modules.

I think you got my problem, but let me clear why foo() is getting
called out of liby.so
When I'm passing only one argument?
foo() in liby.so expecting 2 argument foo(Y st_y, double  val) but I'm
calling foo('c') from main()

Switching to C++ is out of picture, it's legacy code and colossal code base.


> If you can't or won't do that, then you could adjust the linkage or
> visibility of the symbols in all but one library, so they are not
> callable from outside the library. But that will prevent them ever
> being called from outside the library, even if you use the right
> signature.

Thanks for this idea, I have tested by renaming function and works as expected.

>
> You haven't declared these functions in main.c, if you care about
> calling functions with the right signature then you should really
> declare your functions properly!

Sorry it's my bad I just wrote sample code to test, in real code we do
have function declarations.


Thanks
Vijay
;)


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux