mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/Makefile.sub (config.h): added RUBY_COREDLL.
* ext/dl/handle.c (rb_dlhandle_initialize): returns msvcrt if libc or RUBY_COREDLL is given. [ruby-core:22828] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e3cb6518d1
commit
27a39b8ffe
4 changed files with 44 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Mar 17 13:48:08 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* win32/Makefile.sub (config.h): added RUBY_COREDLL.
|
||||
|
||||
* ext/dl/handle.c (rb_dlhandle_initialize): returns msvcrt if libc
|
||||
or RUBY_COREDLL is given. [ruby-core:22828]
|
||||
|
||||
Tue Mar 17 10:29:22 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#else
|
||||
# if defined(HAVE_WINDOWS_H)
|
||||
# include <windows.h>
|
||||
# define dlclose(ptr) FreeLibrary((HINSTANCE)ptr)
|
||||
# define dlopen(name,flag) ((void*)LoadLibrary(name))
|
||||
# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
|
||||
# define dlsym(handle,name) ((void*)GetProcAddress(handle,name))
|
||||
|
|
|
@ -7,6 +7,30 @@
|
|||
|
||||
VALUE rb_cDLHandle;
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef _WIN32_WCE
|
||||
static void *
|
||||
w32_coredll(void)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION m;
|
||||
memset(&m, 0, sizeof(m));
|
||||
if( !VirtualQuery(_errno, &m, sizeof(m)) ) return NULL;
|
||||
return m.AllocationBase;
|
||||
}
|
||||
# endif
|
||||
|
||||
static int
|
||||
w32_dlclose(void *ptr)
|
||||
{
|
||||
# ifndef _WIN32_WCE
|
||||
if( ptr == w32_coredll() ) return 0;
|
||||
# endif
|
||||
if( FreeLibrary((HMODULE)ptr) ) return 0;
|
||||
return errno = rb_w32_map_errno(GetLastError());
|
||||
}
|
||||
#define dlclose(ptr) w32_dlclose(ptr)
|
||||
#endif
|
||||
|
||||
void
|
||||
dlhandle_free(struct dl_handle *dlhandle)
|
||||
{
|
||||
|
@ -72,6 +96,18 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
|
|||
HANDLE rb_libruby_handle(void);
|
||||
ptr = rb_libruby_handle();
|
||||
}
|
||||
else if( STRCASECMP(clib, "libc") == 0
|
||||
# ifdef RUBY_COREDLL
|
||||
|| STRCASECMP(clib, RUBY_COREDLL) == 0
|
||||
|| STRCASECMP(clib, RUBY_COREDLL".dll") == 0
|
||||
# endif
|
||||
){
|
||||
# ifdef _WIN32_WCE
|
||||
ptr = dlopen("coredll.dll", cflag);
|
||||
# else
|
||||
ptr = w32_coredll();
|
||||
# endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
ptr = dlopen(clib, cflag);
|
||||
|
|
|
@ -536,6 +536,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
|
|||
#define RUBY_VENDOR_LIB RUBY_LIB_PREFIX"/vendor_ruby"
|
||||
#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB"/"RUBY_LIB_VERSION
|
||||
#define RUBY_PLATFORM "$(arch)"
|
||||
#define RUBY_COREDLL "$(RT)"
|
||||
#define RUBY_ARCHLIB "/lib/$(RUBY_INSTALL_NAME)/$(ruby_version)/$(ARCH)-$(PLATFORM)"
|
||||
#define RUBY_SITE_ARCHLIB "/lib/$(RUBY_INSTALL_NAME)/site_ruby/$(ruby_version)/$(ARCH)-$(RT)"
|
||||
#define RUBY_VENDOR_ARCHLIB "/lib/$(RUBY_INSTALL_NAME)/vendor_ruby/$(ruby_version)/$(ARCH)-$(RT)"
|
||||
|
|
Loading…
Reference in a new issue