Forum: Ruby Dylib or Bundle on OS X?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
A831f03a29043c6eeb05ec94ac1bf5b0?d=identicon&s=25 Shane Liesegang (sjml)
on 2007-07-05 07:10
Background: I'm trying to embed a Ruby interpreter in my C++
application. (I know, join the club, right?) My query to (and helpful
response from) the SWIG user list is here:
(there's some sample code there as well)

In short, I've got a singleton in C++ which I'm trying to reflect out
into Ruby. The problem is that the Ruby interpreter loads up a second
copy of the library so that the singleton isn't properly shared across
C++ and Ruby. The SWIG list recommended splitting off the wrapped
classes into their own dynamic library that both the executable and the
Ruby module can include.

I'm not sure, though, how to bind the code up in such a way that both an
OS X application and Ruby would be happy working with it. Ruby wants a
bundle, and my attempts to link the dylib into a bundle have just
yielded bad memory access when I try and require it.

Can anyone offer some insight on the best way to accomplish this? Should
I be looking at Frameworks or some other tech instead, or is there a
good way to set up a bundle that references a dylib so that Ruby can
load it as a module?
This topic is locked and can not be replied to.