DevHeads.net

have_func() does not find a func in the given .h file

Hi, in my extconf.rb I check some Ruby functions (since I'm trying
Ruby trunk with rvm). I understand that the method have_func() does
not look into Ruby sources within my .rvm/ directory, so I call the
method by passing the exact file as argument:

/home/ibc/.rvm/repos/ruby$ grep ruby_thread_has_gvl_p vm_core.h
int ruby_thread_has_gvl_p(void);

But have_func() does not find it:

irb> require "mkmf"
irb> have_func("ruby_thread_has_gvl_p", "/home/ibc/.rvm/repos/ruby/vm_core.h")
checking for ruby_thread_has_gvl_p() in
/home/ibc/.rvm/repos/ruby/vm_core.h... no

Am I doint something wrong?
Thanks a lot.

Comments

Re: have_func() does not find a func in the given .h file

By Eric Wong at 06/25/2012 - 00:24

IƱaki Baz Castillo < ... at aliax dot net> wrote:
This is a private function, Ruby uses gcc -fvisibility=hidden to
hide them and only exposes certain functions in vm_core.h
via "#pragma GCC visibility ..."

ave_func() doesn't parse C headers to find functions, but instead
tries to link a C program to find the function.

You're relying too much on ever-changing Ruby internals :)

Re: have_func() does not find a func in the given .h file

By =?UTF-8?Q?I=C3=... at 06/25/2012 - 04:16

2012/6/25 Eric Wong < ... at yhbt dot net>:
Good to know.

Even better to know :)

Well, it's just for temporal debugging purposes. I've
detected/experienced some changes in GVL stuf from 1.9.3 to trunk
version and ruby_thread_has_gvl_p() seems an useful debugging
function.

Thanks a lot.