5

I have a library which at compile time is building a shared object, called libEXAMPLE.so (in the so.le folder), and a dll by the name of EXAMPLE.so (in the dll folder). The two shared objects are quite similar in size and appear to be exactly the same thing. Scouring the internet revealed that there might be a difference in the way programs use the dll to do symbol resolution vs the way it is done with the shared object.

Can you guys please help me out in understanding this?

mrk
  • 4,999
  • 3
  • 27
  • 42
Falcata
  • 679
  • 1
  • 15
  • 23
  • Are they really different? Might be nice to point us at your sources! But to my knowledge, under linux at least (and given that you're talking about .so files, you are under linux, right?), binaries linked at runtime are dealt with using `ld.so`, and can be manipulated by API functions such as `dlopen`. I don't see any differentiation between shared objects and dynamic link libraries in the docs for either. – Rook Nov 08 '12 at 18:50
  • I think the difference lies only in the different formats used to load the dynamic (shared) libraries, but not how exported classes or symbols are used in clients. – πάντα ῥεῖ Nov 08 '12 at 18:51
  • I've heard the general rule of thumb is that if you're planning to link a library at build time then the .so variant should be utilized otherwise if you're loading them using dlopen then dll variant should be used. – Falcata Nov 08 '12 at 19:13
  • @Falcata No, `dlopen()` is just the POSIX compliant interface for loading shared libraries. It doesn't specify anything about the format used for the underlying OS. – πάντα ῥεῖ Nov 08 '12 at 19:57
  • So the answer that I got was that dll libraries are built with the -Bsymbolic compiler option enabled whereas .so shared objects are not. – Falcata Nov 09 '12 at 16:38
  • Duplicate? https://stackoverflow.com/questions/9688200/difference-between-shared-objects-so-static-libraries-a-and-dlls-so – vsekhar Apr 28 '20 at 18:44

2 Answers2

7

"DLL" is how windows like to name their dynamic library

"SO" is how linux like to name their dynamic library

Both have same purpose: to be loaded dynamically.

Windows uses PE binary format and linux uses ELF.

PE: http://en.wikipedia.org/wiki/Portable_Executable

ELF: http://en.wikipedia.org/wiki/Executable_and_Linkable_Format

MasterID
  • 1,510
  • 1
  • 11
  • 15
  • I'm getting a libLIBRARY-NAME.so in the (so folder) and a LIBRARY-NAME.so (in the dll folder). What is the difference between the two? – Falcata Nov 08 '12 at 18:58
  • 1
    @Falcata On which host system are you compiling? It's unlikely that a compiler would produce .dll files in a linux/unix environment unless you're cross-compiling. Maybe it's just a flaw of the libraries build system that you see results in the dll folder at all. – πάντα ῥεῖ Nov 08 '12 at 19:07
  • I'm using QNX to target multiple platforms (ARM etc..). – Falcata Nov 08 '12 at 19:10
0

I suppose a Linux OS.

In Linux, static libraries (.a, also called archives) are used for linking at compile time while shared objects (.so) are used both for linking at load time and at run time.

In your case, it seems that for some reason the library differentiate the files for linking at load time (libEXAMPLE.so) and linking at run time (EXAMPLE.so) even though those 2 files are exactly the same.

MrIo
  • 108
  • 1
  • 10