Patch for MacOS X dln.c
From:
Luc B駘anger <belanglu@...>
Date:
2002-10-13 21:52:09 UTC
List:
ruby-core #541
I have a patch for the dynamic linker in MacOS X, which permit to load
the extension bundle linked dynamically against optional library
(libiconv, readline and gdbm). The Patch is not from me, but from
"Peter O'Gorman" <peter@pogma.com>. We worked around the issue when I
tried to import the ruby 1.7 dev version in the darwinport tree.
The patch is in attachment and is included in the message.
--- dln.c Sat Oct 12 21:20:36 2002
+++ dln.c Sat Oct 12 21:34:36 2002
@@ -90,7 +90,7 @@
int eaccess();
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX)
&& !defined(__APPLE__)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
@@ -1430,10 +1430,14 @@
/* lookup the initial function */
/*NSIsSymbolNameDefined require function name without "_" */
- if(NSIsSymbolNameDefined(buf + 1)) {
+/* if(NSIsSymbolNameDefined(buf + 1)) {
rb_loaderror("Failed to lookup Init function %.200s",file);
}
-
+ Yeah, right, it helps if you use the right test...
+*/
+ if(!NSIsSymbolNameDefined(buf)) {
+ rb_loaderror("Failed to lookup Init function %.200s",file);
+ }
/* NSLookupAndBindSymbol require function name with "_" !! */
init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf));
(*init_fct)();
--
Luc Belanger (450) 773-2649
luc.belanger@acm.org <luc.belanger@acm.org>
--
Luc Belanger (450) 773-2649
luc.belanger@acm.org <luc.belanger@acm.org>
Attachments (1)
patch-dln.c
(922 Bytes, text/x-c++src)
--- dln.c Sat Oct 12 21:20:36 2002
+++ dln.c Sat Oct 12 21:34:36 2002
@@ -90,7 +90,7 @@
int eaccess();
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
@@ -1430,10 +1430,14 @@
/* lookup the initial function */
/*NSIsSymbolNameDefined require function name without "_" */
- if(NSIsSymbolNameDefined(buf + 1)) {
+/* if(NSIsSymbolNameDefined(buf + 1)) {
rb_loaderror("Failed to lookup Init function %.200s",file);
}
-
+ Yeah, right, it helps if you use the right test...
+*/
+ if(!NSIsSymbolNameDefined(buf)) {
+ rb_loaderror("Failed to lookup Init function %.200s",file);
+ }
/* NSLookupAndBindSymbol require function name with "_" !! */
init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf));
(*init_fct)();