diff --git a/ChangeLog b/ChangeLog index cab7961394..592b85a853 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jan 5 12:10:08 2011 Aaron Patterson + + * Use _WIN32 rather than checking for windows.h. Thanks Jon Forums! + [ruby-core:33977] + Sat Jan 1 17:02:50 2011 Yuki Sonoda (Yugui) * lib/irb/locale.rb (IRB::Locale#search_file): make it possible diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index 33ac78490f..f13ff3405f 100644 --- a/ext/dl/cfunc.c +++ b/ext/dl/cfunc.c @@ -23,7 +23,7 @@ rb_dl_set_last_error(VALUE self, VALUE val) return Qnil; } -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) #include static ID id_win32_last_error; @@ -578,7 +578,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary) } rb_dl_set_last_error(self, INT2NUM(errno)); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_dl_set_win32_last_error(self, INT2NUM(GetLastError())); #endif @@ -607,13 +607,13 @@ void Init_dlcfunc(void) { id_last_error = rb_intern("__DL2_LAST_ERROR__"); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) id_win32_last_error = rb_intern("__DL2_WIN32_LAST_ERROR__"); #endif rb_cDLCFunc = rb_define_class_under(rb_mDL, "CFunc", rb_cObject); rb_define_alloc_func(rb_cDLCFunc, rb_dlcfunc_s_allocate); rb_define_module_function(rb_cDLCFunc, "last_error", rb_dl_get_last_error, 0); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_define_module_function(rb_cDLCFunc, "win32_last_error", rb_dl_get_win32_last_error, 0); #endif rb_define_method(rb_cDLCFunc, "initialize", rb_dlcfunc_initialize, -1); diff --git a/ext/dl/dl.h b/ext/dl/dl.h index 2fa330f925..2b3b1f827e 100644 --- a/ext/dl/dl.h +++ b/ext/dl/dl.h @@ -20,7 +20,7 @@ #define RTLD_NOW 0 #endif #else -# if defined(HAVE_WINDOWS_H) +# if defined(_WIN32) # include # define dlopen(name,flag) ((void*)LoadLibrary(name)) # define dlerror() strerror(rb_w32_map_errno(GetLastError())) diff --git a/ext/dl/handle.c b/ext/dl/handle.c index ed042e12c7..6fc771ceb9 100644 --- a/ext/dl/handle.c +++ b/ext/dl/handle.c @@ -7,7 +7,7 @@ VALUE rb_cDLHandle; -#ifdef HAVE_WINDOWS_H +#ifdef _WIN32 # ifndef _WIN32_WCE static void * w32_coredll(void) @@ -142,7 +142,7 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self) rb_secure(2); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) if( !clib ){ HANDLE rb_libruby_handle(void); ptr = rb_libruby_handle(); diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index 3dcd914ddf..03b0ac2765 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -18,7 +18,6 @@ unless have_library('ffi') || have_library('libffi') end have_header 'sys/mman.h' -have_header 'windows.h' create_makefile 'fiddle' diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c index 78e21c57cf..2580ac0e53 100644 --- a/ext/fiddle/fiddle.c +++ b/ext/fiddle/fiddle.c @@ -18,7 +18,7 @@ void Init_fiddle() rb_define_const(mFiddle, "TYPE_FLOAT", INT2NUM(TYPE_FLOAT)); rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE)); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_define_const(mFiddle, "WINDOWS", Qtrue); #else rb_define_const(mFiddle, "WINDOWS", Qfalse); diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h index 4418fafb1e..7165969225 100644 --- a/ext/fiddle/fiddle.h +++ b/ext/fiddle/fiddle.h @@ -4,7 +4,7 @@ #include #include -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) #include #endif diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c index ff18595c13..911c9b80fc 100644 --- a/ext/fiddle/function.c +++ b/ext/fiddle/function.c @@ -125,7 +125,7 @@ function_call(int argc, VALUE argv[], VALUE self) ffi_call(cif, NUM2PTR(rb_Integer(cfunc)), &retval, values); rb_funcall(mFiddle, rb_intern("last_error="), 1, INT2NUM(errno)); -#if defined(HAVE_WINDOWS_H) +#if defined(_WIN32) rb_funcall(mFiddle, rb_intern("win32_last_error="), 1, INT2NUM(errno)); #endif