diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-07-29 09:50:58 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-07-29 09:50:58 +0000 |
commit | 2562004338bc2694a7d8da75f4effcb9aa889641 (patch) | |
tree | 0af9582deace7d436b411552640555f90d7cd9fa /dln.c | |
parent | 3b0fec9a5f966fd7ae26bc7b84877fa7209d8605 (diff) |
sync ev
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln.c')
-rw-r--r-- | dln.c | 43 |
1 files changed, 42 insertions, 1 deletions
@@ -1088,7 +1088,11 @@ dln_sym(name) #endif #ifdef NeXT -/*#include <mach-o/rld.h>*/ +#if NS_TARGET_MAJOR < 4 +#include <mach-o/rld.h> +#else +#include <mach-o/dyld.h> +#endif #endif #ifdef _WIN32 @@ -1316,6 +1320,7 @@ dln_load(file) Mi hisho@tasihara.nest.or.jp, and... Miss ARAI Akino(^^;) ----------------------------------------------------*/ +#if NS_TARGET_MAJOR < 4 /* NeXTSTEP rld functions */ { unsigned long init_address; char *object_files[2] = {NULL, NULL}; @@ -1341,6 +1346,42 @@ dln_load(file) (*init_fct)(); return ; } +#else/* OPENSTEP dyld functions */ + { + int dyld_result ; + NSObjectFileImage obj_file ; /* handle, but not use it */ + /* "file" is module file name . + "buf" is initial function name with "_" . */ + + void (*init_fct)(); + + + dyld_result = NSCreateObjectFileImageFromFile( file, &obj_file ); + + if (dyld_result != NSObjectFileImageSuccess) + { + LoadError("Failed to load %.200s", file); + } + + NSLinkModule(obj_file, file, TRUE); + + + /* lookup the initial function */ + /*NSIsSymbolNameDefined require function name without "_" */ + if( NSIsSymbolNameDefined( buf + 1 ) ) + { + LoadError("Failed to lookup Init function %.200s",file); + } + + /* NSLookupAndBindSymbol require function name with "_" !! */ + + init_fct = NSAddressOfSymbol( NSLookupAndBindSymbol( buf ) ); + (*init_fct)(); + + + return ; + } +#endif /* rld or dyld */ #endif #ifdef __BEOS__ |