зеркало из https://github.com/github/ruby.git
* ext/dl/dl.h (dlerror): fixed on Windows.
* ext/dl/handle.c (rb_dlhandle_initialize): returns handle to libruby if nil is given on Windows as dlopen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
46e06b572b
Коммит
033bed37c8
|
@ -1,4 +1,9 @@
|
|||
Mon Mar 2 10:50:53 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Mon Mar 2 11:01:45 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/dl/dl.h (dlerror): fixed on Windows.
|
||||
|
||||
* ext/dl/handle.c (rb_dlhandle_initialize): returns handle to
|
||||
libruby if nil is given on Windows as dlopen.
|
||||
|
||||
* ext/dl/handle.c (rb_dlhandle_sym): get rid of buffer overrun,
|
||||
and try ASCII WINAPI versions too.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
# include <windows.h>
|
||||
# define dlclose(ptr) FreeLibrary((HINSTANCE)ptr)
|
||||
# define dlopen(name,flag) ((void*)LoadLibrary(name))
|
||||
# define dlerror() "unknown error"
|
||||
# define dlerror() strerror(rb_w32_map_errno(GetLastError()))
|
||||
# define dlsym(handle,name) ((void*)GetProcAddress(handle,name))
|
||||
# define RTLD_LAZY -1
|
||||
# define RTLD_NOW -1
|
||||
|
|
|
@ -67,6 +67,13 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
|
|||
rb_bug("rb_dlhandle_new");
|
||||
}
|
||||
|
||||
#if defined(HAVE_WINDOWS_H)
|
||||
if( !clib ){
|
||||
HANDLE rb_libruby_handle(void);
|
||||
ptr = rb_libruby_handle();
|
||||
}
|
||||
else
|
||||
#endif
|
||||
ptr = dlopen(clib, cflag);
|
||||
#if defined(HAVE_DLERROR)
|
||||
if( !ptr && (err = dlerror()) ){
|
||||
|
|
6
ruby.c
6
ruby.c
|
@ -325,6 +325,12 @@ DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
|
|||
libruby = dll;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HANDLE
|
||||
rb_libruby_handle(void)
|
||||
{
|
||||
return libruby;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ruby_init_loadpath_safe(int safe_level);
|
||||
|
|
Загрузка…
Ссылка в новой задаче