From: "Luc Bélanger" Date: 2002-10-14T06:52:09+09:00 Subject: Patch for MacOS X dln.c --Apple-Mail-11-404121901 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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" . 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)(); --Apple-Mail-11-404121901 Content-Disposition: attachment; filename=patch-dln.c Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="patch-dln.c" --- 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)(); --Apple-Mail-11-404121901 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed -- Luc Belanger (450) 773-2649 luc.belanger@acm.org -- Luc Belanger (450) 773-2649 luc.belanger@acm.org --Apple-Mail-11-404121901--