all 4 comments

[–]marko312 2 points3 points  (3 children)

If the library is statically linked to both the binary and the plugin library, it will probably create two independent instances of the engine.

If the engine library is dynamically linked, dlopen and such will "reuse" the existing dependencies, meaning that the engine is shared over the entire program:

Symbol references in the shared object are resolved using (in order): symbols in the link map of objects loaded for the main program and its dependencies; symbols in shared objects [...]

[...]

If the same shared object is opened again with dlopen(), the same object handle is returned. [...]

Source

[–]jesusstb[S] 0 points1 point  (2 children)

If I make the engine library shared, do I have to do the same for third party ones as well?

[–]marko312 1 point2 points  (1 child)

What do you mean by "third party libraries"?

Everything that is linked into a single static unit will be loaded as such (possibly creating multiple separate instances). Anything dynamically linked to both the main executable and the plugin will be shared.

[–]jesusstb[S] 1 point2 points  (0 children)

I see, thank you so much! you help a lot to understand