Code::Blocks shared libraries....soname?

Started by
2 comments, last by ForgottenMaster 14 years ago
Hi everyone, I have started using Code::Blocks for my development and have been trying to create a shared library using it. This works fine and generates the required library (libGLUTMaster.so.1.0.0) However, I cannot find a way to specify the soname for the library for Code::Blocks to use when linking, I have tried putting the option -Wl,-soname,libGLUTMaster.so.1 into the compiler settings section, and have also tried it passing the option directly to the linker in the linker settings section with -soname=libGLUTMaster.so.1 In both these cases, the library was not linked with a soname specified. Any help with this would be appreciated, Thanks
Advertisement
I don't think that there is actually an option for that particular thing, but you could try adding the library to the "link libraries" tab with the full pathname to the library, not just the basename. With any luck, that should work.
I've found that the easier way to link my libraries is to add their path to the list of the link paths. Then I just add the library name to the list of libraries I need to link to (without the lib and .so.etc).

Then you can have the list of libraries in the general configuration and the specific path for release/debug in the link path TAB for each configuration.

EDIT: Wait, if you're on Linux, this wont work very well.
[size="2"]I like the Walrus best.
Thanks for the replies guys, the problem isnt in the linking as such...

I can create my library, and a demo program linking to that library quite easily, however when I inspect the resulting binary using ldd it shows that the binary links to libGLUTMaster.so at runtime

This isn't so much a problem since I am not expecting the compiled library of glutmaster to change much in the future, certainly not expecting the interface to change, however, if in the future I use this to compile my own libraries and to create binaries using these libraries, it is not safe for the binary to be looking for libGLUTMaster.so at runtime

The binary should be looking for libGLUTMaster.so.1 at runtime, enforcing the interface of the library used in compilation. The only reason I can see why the binary is not linking to the soname of the library is because the soname is not being defined

I am just wondering why the compiler and linker options i'm setting wouldn't work :s
I have now solved this problem, I hadn't tried putting the option "-Wl,-soname,libGLUTMaster.so.1" into the "linker settings" section, and as soon as I did, it linked with the correct soname as required....its always the case with programming that the solution is a simple one thats been overlooked :p

This topic is closed to new replies.

Advertisement