aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb11
1 files changed, 9 insertions, 2 deletions
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}