Synthetix
Synthetix

Reputation: 2135

Does a dynamically linked executable use the static code of a parent process?

Let's say I have binary A that dynamically links to some shared library. I statically-compile that library into binary B, then fork/exec binary A from binary B. Will binary A use the static functions in binary B since it is now a child process of binary B?

Upvotes: 0

Views: 77

Answers (1)

PhilMasteG
PhilMasteG

Reputation: 3185

No, since A is its own binary, it has its own links. Since A was linked dynamically to the library, these links stay to the dynamic library.

Also, a simple exec does not automatically allow A to access the memory of B, so A does not even have the possibility to acces the static library code inside of B, even if it wanted to.

Upvotes: 2

Related Questions