From 2bd0c2bf73acd0841619f67e3448573e5b6e3064 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 22 Mar 2002 07:26:42 +0000 Subject: * the VMS support patch submitted by Akiyoshi, Masamichi 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 --- dln.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'dln.c') diff --git a/dln.c b/dln.c index 100fa08a10..4e39bc8afb 100644 --- a/dln.c +++ b/dln.c @@ -48,7 +48,7 @@ void *xrealloc(); #endif #include -#ifdef NT +#if defined(NT) || defined(__VMS) #include "missing/file.h" #endif #include @@ -72,6 +72,11 @@ void *xrealloc(); char *getenv(); #endif +#if defined(__VMS) +#pragma builtins +#include +#endif + #ifdef __MACOS__ # include # include @@ -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 -- cgit v1.2.3