[MacRuby-devel] How to create loadable MacRuby bundle
lsansonetti at apple.com
Mon Oct 13 22:42:57 PDT 2008
On Oct 13, 2008, at 6:59 PM, Antonin Hildebrand wrote:
> Is it possible to create loadable MacRuby bundle to be loaded into
> another MacRuby application?
> I'm looking for replacement for RBBundleInit as described for
> RubyCocoa here:
> I'm loading bundles into my MacRuby app via:
trunk has a preliminary Objective-C API that allows pure Objective-C
apps to initialize and use MacRuby (look at the MacRuby class defined
in the objc.h file in trunk), and RBBundleInit could therefore be
implemented based on that.
Could you give more details about what you are trying to do exactly?
Loading a MacRuby bundle in a MacRuby app looks weird, you could just
require the Ruby scripts.
If you want to load a .bundle that contains native code in a MacRuby
app, you can use the NSBundle API. You could also generate a dynamic
library and "require" it (assuming you have an Init_xxx exported
If you want to load a .bundle that contains MacRuby code in a non-
MacRuby application, you will need the new Objective-C API (or use the
standard C API) to prepare the bundle. I could work on a sample code
that illustrates this if needed. The bundle could theoretically be
loaded in MacRuby apps as well, thought it would be a little bit
overkill since you could just directly "require" the Ruby scripts.
More information about the MacRuby-devel