summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ruby.c b/ruby.c
index e3c69c7..6d8caac 100644
--- a/ruby.c
+++ b/ruby.c
@@ -238,11 +238,12 @@ ruby_init_loadpath()
char *p;
int rest;
#if defined _WIN32 || defined __CYGWIN__
-# if defined LIBRUBY_SO
- HMODULE libruby = GetModuleHandle(LIBRUBY_SO);
-# else
HMODULE libruby = NULL;
-# endif
+ MEMORY_BASIC_INFORMATION m;
+
+ memset(&m, 0, sizeof(m));
+ if (VirtualQuery(ruby_init_loadpath, &m, sizeof(m)) && m.State == MEM_COMMIT)
+ libruby = (HMODULE)m.AllocationBase;
GetModuleFileName(libruby, libpath, sizeof libpath);
#elif defined(DJGPP)
extern char *__dos_argv0;