Dylib or Bundle on OS X?

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?