From e149ee88cf53bb5665ab240a138be41d0b337ea8 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Fri, 25 May 2001 21:10:58 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v1_6_4_preview4'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_6_4_preview4@1459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dln.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'dln.c') diff --git a/dln.c b/dln.c index c843bee57b..d2c2c78c1b 100644 --- a/dln.c +++ b/dln.c @@ -1166,7 +1166,7 @@ dln_strerror() } -#if defined(_AIX) +#if defined(_AIX) && ! defined(_IA64) static void aix_loaderror(const char *pathname) { @@ -1214,7 +1214,7 @@ aix_loaderror(const char *pathname) } #endif -void +void* dln_load(file) const char *file; { @@ -1234,23 +1234,21 @@ dln_load(file) /* Load file */ if ((handle = LoadLibraryExA(winfile, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) == NULL) { - printf("LoadLibraryExA: %s\n", winfile); goto failed; } if ((init_fct = (void(*)())GetProcAddress(handle, buf)) == NULL) { - printf("GetProcAddress %s\n", buf); - goto failed; + rb_loaderror("%s - %s\n%s", dln_strerror(), buf, file); } /* Call the init code */ (*init_fct)(); - return; + return handle; #else #ifdef USE_DLN_A_OUT if (load(file) == -1) { goto failed; } - return; + return 0; #else char buf[MAXPATHLEN]; @@ -1276,11 +1274,12 @@ dln_load(file) } if ((init_fct = (void(*)())dlsym(handle, buf)) == NULL) { + dlclose(handle); goto failed; } /* Call the init code */ (*init_fct)(); - return; + return handle; } #endif /* USE_DLN_DLOPEN */ @@ -1306,11 +1305,11 @@ dln_load(file) } } (*init_fct)(); - return; + return (void*)lib; } #endif /* hpux */ -#if defined(_AIX) +#if defined(_AIX) && ! defined(_IA64) #define DLN_DEFINED { void (*init_fct)(); @@ -1323,7 +1322,7 @@ dln_load(file) aix_loaderror(file); } (*init_fct)(); - return; + return (void*)init_fct; } #endif /* _AIX */ @@ -1362,7 +1361,7 @@ dln_load(file) init_fct = (void(*)())init_address; (*init_fct)(); - return; + return (void*)init_address; } #else/* OPENSTEP dyld functions */ { @@ -1392,7 +1391,7 @@ dln_load(file) init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf)); (*init_fct)(); - return; + return (void*)init_fct; } #endif /* rld or dyld */ #endif @@ -1440,7 +1439,7 @@ dln_load(file) /* call module initialize function. */ (*init_fct)(); - return; + return (void*)img_id; } #endif /* __BEOS__*/ @@ -1488,7 +1487,7 @@ dln_load(file) init_fct = (void (*)())symAddr; (*init_fct)(); - return; + return (void*)init_fct; } #endif /* __MACOS__ */ @@ -1669,7 +1668,7 @@ dln_find_1(fname, path, exe_flag) if (stat(fbuf, &st) == 0) { if (exe_flag == 0) return fbuf; /* looking for executable */ - if (eaccess(fbuf, X_OK) == 0) return fbuf; + if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0) return fbuf; } #else if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) { -- cgit v1.2.3