.so Files Question

I apologize if this isn't directly related to C++, but I was wondering if .so files work like .dll files. As in, if I have a library that builds dynamically, I have to supply my program with the appropriate .dll files. I was wondering if the same would apply with .so files. Could I just distribute my executable with the .so files in the same directory so that nobody has to install anything extra?

If not, is there a way to do this by loading it directly from within the program?
You normally don't distribute executables with .so files. .so files are usually not searched for in the current/executable directory so it wouldn't work. The best is probably to distribute the source and let the user compile and install the libraries needed.
closed account (S6k9GNh0)
You can do so which Peter87 failed to mention. Almost all indie games for Linux do this. You may look at one of their examples for a reference (most including libc since libc versions differ from distribution to distribution). You would use /usr{/local}/share (which is a bit more complicated and less common now adays since this is more commonly used for assets rather than libraries) or /usr{/local}/lib. Some games install into your home directory and then use desktop links to execute the game since the home directory is generally partitioned on a larger drive and games should be executed with user-specific permissions anyways.

However, it is better if you rely on a stable version of a library and allow the user to install the libraries himself via his tools provided by his distribution.

Unfortunately, this isn't as simple as it may sound. For instance, what if you use a library that isn't very popular? You have many choice but not many of them feel right. Distribution on *nix is not easy at all.
Last edited on
And yet developing for *nix is WAY too easy. It's so odd. Well thanks, every little bit of information helps.
closed account (S6k9GNh0)
Supporting one distribution is beyond easy. Supporting multiple is what gets tricky. Ubuntu likes to keep libraries nice and out of date since that's what they consider "stable". Arch Linux and Fedora do the exact opposite. There's obviously going to be versioning issues.
Topic archived. No new replies allowed.