Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plug-ins and shared object libraries

I understand that plug-ins are components that are tasked with a specific function and loaded for use by an application.

Shared object libraries (.so) in linux and .dlls in windows are libraries that are loaded at run-time by an application.

I want to understand what if .dll / .so are always plug-ins. Are all plug-ins .dll / .sos?

like image 387
no_op Avatar asked Mar 14 '26 15:03

no_op


1 Answers

Actually, .dll's and .so's are dynamic libraries. There are also other type libraries named static libraries. In Linux, their extension is .a.

Programmers tend to use libraries for maintaining their code easily. Also, if the library will be shared more than one application, shared library is chosen because of main memory usage.

You can apply this logic for a structure which contains plug-ins. If the code piece will be used only by your application's single process, you can use static library as your plug-in. However, if the code will be shared by multiple processes, you should use shared libraries, even if these process are instances of the same application.

When you use shared libraries as plug-ins, you must not include library as known methods and you must not link your executable directly to the library. Instead you must use libdl. Have a look at here and look for the dynamic loading.

like image 111
Ricardo Cristian Ramirez Avatar answered Mar 16 '26 09:03

Ricardo Cristian Ramirez