[MacRuby-devel] Compile command line app

Matt Aimonetti mattaimonetti at gmail.com
Tue May 29 08:53:18 PDT 2012


from the man file:

   When building an executable, the very first file passed to macrubyc will
be considered as the main file. Its machine code will be run once the
executable starts. Other
     machine code files will be linked into the executable, but only run
upon calls to the require method.

           $ echo "def t1; 21; end" > t1.rb
           $ echo "def t2; 21; end" > t2.rb
           $ echo "require 't1'; require 't2'; p t1+t2" > test.rb
           $ macrubyc test.rb t1.rb t2.rb -o test
           $ ./test


- Matt

On Tue, May 29, 2012 at 5:45 PM, Enrico Pilotto <enrico at megiston.it> wrote:

> Oh good!
> But now i've another problem:
> if I have only one file all work (macrubyc myfile.rb)
> but if I have 2 files where 1 file require the other, I dont know how to
> compile the 2 files...
> Ive try
>
> macrubyc -c file1.rb -o file1.o
> macrubyc -c file2.rb -o file2.o
> macrubyc file1.o file2.o -o exec
>
> Now when I run the ./exec i have the error: no such file to load --
> (LoadError)
>
> There is a way?
>
> Il 29/05/12 14:14, Francis Chong ha scritto:
> > You can compile any ruby file with macrubyc. For anything more complex
> > you probably want to check macruby_deploy.
> >
> > There is an old post at:
> > http://macruby.macosforge.org/blog/2009/11/17/macruby05b2.html which
> > should still valid.
> >
> >
> >
> > --
> > Francis Chong
> > Ignition Soft
> >
> > On 2012年5月29日Tuesday at 下午7:36, Enrico Pilotto wrote:
> >
> >> Hi, there is a way to create a command line tool with XCode using
> macruby?
> >>
> >> I've a little program that run with 'macruby main.rb', but now i want
> >> create an executable file... There is a way to compile the macruby
> source?
> >>
> >> Thanks, Enrico.
>
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20120529/c94d74b4/attachment.html>


More information about the MacRuby-devel mailing list