summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-02 02:01:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-02 02:01:48 +0000
commit61c490b82653bb9f3458b56a26806846696b59f0 (patch)
tree72abc033de81c810b9f1b0db6910f815c9ed7119 /ext
parent14760f7beff6a1f281f2c5a8bedd8048ad0f8e9a (diff)
downloadruby-61c490b82653bb9f3458b56a26806846696b59f0.tar.gz
ruby-61c490b82653bb9f3458b56a26806846696b59f0.tar.xz
ruby-61c490b82653bb9f3458b56a26806846696b59f0.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@22703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/dl/dl.h2
-rw-r--r--ext/dl/handle.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
index 753bd1c97..fb904bc56 100644
--- a/ext/dl/dl.h
+++ b/ext/dl/dl.h
@@ -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
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index b8752004b..c4ee0b9c1 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -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()) ){