From a85e47072ff808846242da49295b4b73af23b840 Mon Sep 17 00:00:00 2001 From: johannst Date: Wed, 21 Jun 2023 21:15:05 +0000 Subject: deploy: 35dc3c48a50594148554010ac626480161ad357a --- development/ld.so.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'development/ld.so.html') diff --git a/development/ld.so.html b/development/ld.so.html index 5a8326e..9e8ce60 100644 --- a/development/ld.so.html +++ b/development/ld.so.html @@ -83,7 +83,7 @@ @@ -157,6 +157,19 @@ =symbols show search path for symbol lookup =bindings show against which definition a symbol is bound +

LD_LIBRARY_PATH and dlopen(3)

+

When dynamically loading a shared library during program runtime with +dlopen(3), only the LD_LIBRARY_PATH as it was during program startup is +evaluated. +Therefore the following is a code smell:

+
// at startup LD_LIBRARY_PATH=/moose
+
+// Assume /foo/libbar.so
+setenv("LD_LIBRARY_PATH", "/foo", true /* overwrite */);
+
+// Will look in /moose and NOT in /foo.
+dlopen("libbar.so", RTLD_LAZY);
+

Libraries specified in LD_PRELOAD are loaded from left-to-right but initialized from right-to-left.

-- cgit v1.2.3