Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use one Linux .so for all Linux compilers?

Tags:

c

linux

dll

We need to integrate a closed-source C library into our project. The other party can compile the library in any mode we need, but we support a lot of different Windows and Linux compilers.

I know a DLL will be compatible with all major Windows compilers, so we could only use one library for Windows. But I’m not familiar with Linux dynamic libraries (.so). Are these compatible across all Linux environments in a similar way?

Thanks

like image 456
Neil Kirk Avatar asked Oct 20 '25 09:10

Neil Kirk


1 Answers

You may have some issues w.r.t. the version of the GNU libc against which that shared library libotherparty.so has been linked (and compiled).

You certainly need to know the version of the libc, and you might require that party to ship several variants of the binary library.

I would strongly suggest to read Drepper's paper: How To Write Shared Libraries. See also this question and Levine's linker & loader book.

If it is C code, the compiler does not matter much. What matters more is the ABI. Learn also about symbol versioning.

Be prepared to have some trouble.

You'll learn by experience that free software is preferable.

like image 93
Basile Starynkevitch Avatar answered Oct 21 '25 23:10

Basile Starynkevitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!