How large it is to embedding ruby

Discussion in 'Ruby' started by nkb, Oct 2, 2004.

  1. nkb

    nkb Guest

    Hi.
    I would like to be able to call and execute ruby scripts from my C/C++
    program. So, I'm considering embedding ruby into my codes. Before I dig
    into the details, I was wondering if anyone might have an idea how large
    is the source for ruby main library? in terms of lines of codes and if
    anyone has advise on what I shld watch out when embedding ruby? Thanks!!!
     
    nkb, Oct 2, 2004
    #1
    1. Advertising

  2. On Sat, Oct 02, 2004 at 12:19:47PM +0900, nkb wrote:
    > Hi.
    > I would like to be able to call and execute ruby scripts from my C/C++
    > program. So, I'm considering embedding ruby into my codes. Before I dig
    > into the details, I was wondering if anyone might have an idea how large
    > is the source for ruby main library? in terms of lines of codes and if
    > anyone has advise on what I shld watch out when embedding ruby? Thanks!!!


    There's a good introduction here:
    http://www.rubycentral.com/book/ext_ruby.html

    - Lines of code that your program needs: very few!
    - Lines of code of the Ruby interpreter: lots, but if you link against the
    dynamic (shared) library, that won't make any difference. If you link
    against the static library your program may grow by about 1MB. Remember that
    most Ruby programs do "require xxx" so you need those Ruby libraries around
    at run-time too.

    On my system (FreeBSD 5.2.1), the command-line program "ruby" is only 3
    kilobytes!

    $ ls -l /usr/local/bin/ruby
    -rwxr-xr-x 2 root wheel 3404 Jun 23 20:14 /usr/local/bin/ruby
    $ file /usr/local/bin/ruby
    /usr/local/bin/ruby: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for FreeBSD 5.0.2, dynamically linked (uses shared libs), stripped
    $ ldd /usr/local/bin/ruby
    /usr/local/bin/ruby:
    libruby18.so.18 => /usr/local/lib/libruby18.so.18 (0x28073000)
    libcrypt.so.2 => /lib/libcrypt.so.2 (0x2813a000)
    libm.so.2 => /lib/libm.so.2 (0x28153000)
    libc.so.5 => /lib/libc.so.5 (0x2816c000)

    That's because the core of the ruby interpreter is in libruby18.so

    -rw-r--r-- 1 root wheel 1186776 Jun 23 20:14 /usr/local/lib/libruby18-static.a
    lrwxrwxrwx 1 root wheel 15 Jun 23 20:14 /usr/local/lib/libruby18.so -> libruby18.so.18
    -rwxr-xr-x 1 root wheel 863872 Jun 23 20:14 /usr/local/lib/libruby18.so.18

    Regards,

    Brian.
     
    Brian Candler, Oct 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ketchup
    Replies:
    1
    Views:
    250
    Jan Tielens
    May 25, 2004
  2. Brian Candler

    Embedding ruby - name clashes

    Brian Candler, Jul 22, 2003, in forum: Ruby
    Replies:
    0
    Views:
    97
    Brian Candler
    Jul 22, 2003
  3. Basile STARYNKEVITCH

    embedding ruby - some questions

    Basile STARYNKEVITCH, Aug 31, 2003, in forum: Ruby
    Replies:
    0
    Views:
    124
    Basile STARYNKEVITCH
    Aug 31, 2003
  4. Charles Comstock
    Replies:
    1
    Views:
    121
    Lyle Johnson
    Jun 25, 2004
  5. Replies:
    5
    Views:
    881
    Xho Jingleheimerschmidt
    Apr 2, 2009
Loading...

Share This Page