diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-22 07:26:42 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-22 07:26:42 +0000 |
commit | 2bd0c2bf73acd0841619f67e3448573e5b6e3064 (patch) | |
tree | 8d1f8bb30c4092ea1c809a0f7bfe65bb0cd94d66 /dln.c | |
parent | 890521d11783ac21503052e2a5f86c4ddfc6a9d8 (diff) | |
download | ruby-2bd0c2bf73acd0841619f67e3448573e5b6e3064.tar.gz |
* the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged.
* eval.c (exec_under): changing ruby_class is OK, but should not
alter cbase.
* eval.c (yield_under_i): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln.c')
-rw-r--r-- | dln.c | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -48,7 +48,7 @@ void *xrealloc(); #endif #include <stdio.h> -#ifdef NT +#if defined(NT) || defined(__VMS) #include "missing/file.h" #endif #include <sys/types.h> @@ -72,6 +72,11 @@ void *xrealloc(); char *getenv(); #endif +#if defined(__VMS) +#pragma builtins +#include <dlfcn.h> +#endif + #ifdef __MACOS__ # include <TextUtils.h> # include <CodeFragments.h> @@ -1517,6 +1522,33 @@ dln_load(file) } #endif /* __MACOS__ */ +#if defined(__VMS) +#define DLN_DEFINED + { + void *handle, (*init_fct)(); + char *fname, *p1, *p2; + + fname = (char *)__alloca(strlen(file)+1); + strcpy(fname,file); + if (p1 = strrchr(fname,'/')) + fname = p1 + 1; + if (p2 = strrchr(fname,'.')) + *p2 = '¥0'; + + if ((handle = (void*)dlopen(fname, 0)) == NULL) { + goto failed; + } + + if ((init_fct = (void (*)())dlsym(handle, buf)) == NULL) { + dlclose(handle); + goto failed; + } + /* Call the init code */ + (*init_fct)(); + return handle; + } +#endif /* __VMS */ + #ifndef DLN_DEFINED rb_notimplement("dynamic link not supported"); #endif |