Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which one is recommended: using static lib vs dynamic lib (shared object)

I am working with an application in Linux. It supports both static and dynamic (.so) versions

From the performance standpoint, which version should a user use? The application performs computational tasks that require several hours of CPU time.

Any other advantage of using one lib over the other?

Thanks

like image 474
memC Avatar asked Dec 29 '22 03:12

memC


1 Answers

From pure performance point of view:

Shared Objects are compiled as PIC (position independent code) that theoretically may be slightly less efficient then normal code on some architectures (including x86).

However, I don't think this would make any real difference.

From any other points

Use shared object, it has too many advantages over static library that it is just better alternative.

like image 114
Artyom Avatar answered Dec 31 '22 16:12

Artyom