diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/win32ole/extconf.rb | 10 | ||||
-rw-r--r-- | lib/mkmf.rb | 11 |
3 files changed, 23 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Thu Nov 11 21:32:09 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/mkmf.rb (try_func): accept variable address. + + * ext/win32ole/extconf.rb: libuuid is needed on cygwin. + Thu Nov 11 21:24:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * file.c (file_expand_path): use cygwin_conv_path on cygwin 1.7 or diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb index 893793382b..95f229b041 100644 --- a/ext/win32ole/extconf.rb +++ b/ext/win32ole/extconf.rb @@ -4,7 +4,13 @@ #---------------------------------- require 'mkmf' -dir_config("win32") +case RUBY_PLATFORM +when /cygwin/ + inc = nil + lib = '/usr/lib/w32api' +end + +dir_config("win32", inc, lib) SRCFILES=<<SRC win32ole.c @@ -19,7 +25,7 @@ end def create_win32ole_makefile if have_library("ole32") and have_library("oleaut32") and - have_library("uuid") and + have_library("uuid", "&CLSID_CMultiLanguage", "mlang.h") and have_library("user32") and have_library("kernel32") and have_library("advapi32") and diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 4b196565ee..fc6bd08db4 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -583,13 +583,20 @@ end # names of header files. def try_func(func, libs, headers = nil, &b) headers = cpp_include(headers) + case func + when /^&/ + decltype = proc {|x|"const volatile void *#{x}"} + else + call = true + decltype = proc {|x| "void ((*#{x})())"} + end try_link(<<"SRC", libs, &b) or #{headers} /*top*/ #{MAIN_DOES_NOTHING} -int t() { void ((*volatile p)()); p = (void ((*)()))#{func}; return 0; } +int t() { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; } SRC - try_link(<<"SRC", libs, &b) + call && try_link(<<"SRC", libs, &b) #{headers} /*top*/ #{MAIN_DOES_NOTHING} |