changeset 8271:095b3e4d64e9

oct-shlib.cc: use RTLD_NOW option for dlopen
author John W. Eaton <jwe@octave.org>
date Thu, 23 Oct 2008 13:00:46 -0400
parents 5a2e45facabe
children ed5811a1ec8f
files liboctave/ChangeLog liboctave/oct-shlib.cc
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-23  John W. Eaton  <jwe@octave.org>
+
+	* oct-shlib.cc (octave_dlopen_shlib::open): Use RTLD_NOW instead
+	of RTLD_LAZY.
+
 2008-10-12  Jaroslav Hajek <highegg@gmail.com>
 
 	* CSparse.cc (ComplexMatrix::expm): Improve inverse preconditioning
--- a/liboctave/oct-shlib.cc
+++ b/liboctave/oct-shlib.cc
@@ -243,8 +243,12 @@
 
       int flags = 0;
 
-#if defined (RTLD_LAZY)
-      flags |= RTLD_LAZY;
+      // Use RTLD_NOW to resolve all symbols before dlopen returns.
+      // By using this option, dlopen will detect errors and Octave
+      // won't exit if there are unresolved symbols in the file we are
+      // loading, and we may even get a useful diagnostic.
+#if defined (RTLD_NOW)
+      flags |= RTLD_NOW;
 #endif
 
 #if defined (RTLD_GLOBAL)