1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ruby.c (DllMain, ruby_init_loadpath): use DLL instance handle given

to DllMain instead of VirtualQuery so that loadpath becomes relative
  from the DLL on WinCE too.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-05-18 02:11:42 +00:00
parent b21d410d4e
commit 635c599d6b
3 changed files with 22 additions and 12 deletions

View file

@ -1,3 +1,9 @@
Fri May 18 11:12:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (DllMain, ruby_init_loadpath): use DLL instance handle given
to DllMain instead of VirtualQuery so that loadpath becomes relative
from the DLL on WinCE too.
Thu May 17 17:03:11 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* misc/ruby-style.el (ruby-style-label-indent): for yacc rules.

22
ruby.c
View file

@ -259,6 +259,18 @@ translate_char(char *p, int from, int to)
}
#endif
#if defined _WIN32 || defined __CYGWIN__
static HMODULE libruby;
BOOL WINAPI
DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
{
if (reason == DLL_PROCESS_ATTACH)
libruby = dll;
return TRUE;
}
#endif
void
ruby_init_loadpath(void)
{
@ -266,16 +278,8 @@ ruby_init_loadpath(void)
char libpath[MAXPATHLEN + 1];
char *p;
int rest;
#if defined _WIN32 || defined __CYGWIN__
HMODULE libruby = NULL;
MEMORY_BASIC_INFORMATION m;
#ifndef _WIN32_WCE
memset(&m, 0, sizeof(m));
if (VirtualQuery(ruby_init_loadpath, &m, sizeof(m))
&& m.State == MEM_COMMIT)
libruby = (HMODULE) m.AllocationBase;
#endif
#if defined _WIN32 || defined __CYGWIN__
GetModuleFileName(libruby, libpath, sizeof libpath);
#elif defined(DJGPP)
extern char *__dos_argv0;

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-05-17"
#define RUBY_RELEASE_DATE "2007-05-18"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070517
#define RUBY_RELEASE_CODE 20070518
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 17
#define RUBY_RELEASE_DAY 18
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];