[MacRuby-devel] A path to linking rbo files into one executable in Xcode

Dylan Bruzenak dylan at ideaswarm.com
Wed Nov 25 10:21:40 PST 2009


Hi all,

First, great work with the 0.5b2 release. I'm starting to use this for more
serious development and it does most of the things I need very well. After a
brief struggle last night I managed to get the code for one of my projects
compiling using the new macruby_deploy method and it works like a charm.

However, I would like to include the .rbo files in the same executable
inside the .app bundle as my objc files, rather than as separate files in
the resources directory.

To that end I defined a build rule that picks up .rb files and uses macrubyc
to compile them. I moved the .rb files into the 'compile sources' build
step, which causes the output .o files to be included in the excutable.

I then ran into an obvious snag: the ruby environment isn't intialized and
the classes are not being pulled in. After some investigation of the rubyc
file I can see that you're creating a custom .mm file that calls a number of
set up methods for the runtime and an MREP_UUID function for each class. A
few questions:

1.) Is there a way that I can find these MREP function names and call them
dynamically ? I was considering modifying the generator to output a .m file
with a class that just has an init method that calls these, but it isn't
compatible with the build rule approach above.
2.) Is there an easier way to set up this environment than the code below ?

ruby_sysinit(&argc, &argv);
    if (argc > 0) {
argc--;
        argv++;
    }
    ruby_init();
    ruby_set_argv(argc, argv);
    rb_vm_init_compiler();
    try {
        void *self = rb_vm_top_self();
        //MREP FUNCTION CALLS GO HERE :)
}
    catch (...) {
rb_vm_print_current_exception();
rb_exit(1);
    }
    rb_exit(0);

3.) Am I nuts ? If there's a much easier way to do this, please let me know
:)

thanks!
- Dylan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091125/05eb517c/attachment.html>


More information about the MacRuby-devel mailing list