[LRUG] Ruby 1.9 problem - mutex lib not loading properly

James Fairbairn james at netlagoon.com
Wed Aug 12 14:47:10 PDT 2009


Hi Alex,
There's a lot of inconclusive stuff on the net about embedding Ruby 1.9, but
one thing we've found we have to do (and this in a function that doesn't
return, i.e. main()[1]), is call the RUBY_INIT_STACK macro.

In the system I'm working on, we also call ruby_sysinit(), but I don't have
the full code in front of me, so I can't tinker with it. Anyway, here's our
boot-up-ruby sequence:

ruby_sysinit(&fake_argc, const_cast<char ***>(&fake_argv_star));
 RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();

Hope this helps. Let me know how you get on.

James

[1] http://www.ruby-forum.com/topic/149451


2009/8/11 Alex MacCaw <maccman at gmail.com>

> I'm trying to evaluate Ruby (1.9) from C++.
>
> The code looks something like this:
>
>    rb_eval_string_protect("require 'thread'; m = Mutex.new; m.synchronize
> {};", &error);
>
> The error I get is: undefined method `synchronize' for #<Mutex:0x1f8cf4>
>
> It looks like the mutex class (which is written in C) isn't getting loaded
> properly. Anybody got any ideas as to why?
> The code works fine in Ruby 1.8
>
> http://pastie.org/579760
>
> --
> http://www.leadthinking.com | http://socialmod.com
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20090812/f15df074/attachment-0003.html>


More information about the Chat mailing list