Jump to content
  • Advertisement
Sign in to follow this  
ForgottenMaster

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

This topic is 3169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!