extconf.rb >> mkmf

Discussion in 'Ruby' started by K. R., Nov 12, 2007.

  1. K. R.

    K. R. Guest

    hi @all

    I would like to extend my rubyapp with a c++ program. I used the
    features of mkmf (require 'mkmf') and saved it into the extconf.rb. So
    already the whole program is running, but I want to compile the c-file
    with g++ instead of gcc compiler.

    How can I change this options?
    Thanks for your posting!
    --
    Posted via http://www.ruby-forum.com/.
    K. R., Nov 12, 2007
    #1
    1. Advertising

  2. K. R.

    Young Hyun Guest

    On Nov 12, 2007, at 8:15 AM, K. R. wrote:

    > hi @all
    >
    > I would like to extend my rubyapp with a c++ program. I used the
    > features of mkmf (require 'mkmf') and saved it into the extconf.rb. So
    > already the whole program is running, but I want to compile the c-file
    > with g++ instead of gcc compiler.
    >
    > How can I change this options?


    I had a similar problem and came up with this ugly hack (hopefully
    there's a more official way to do this) which works at least under
    MacOS X and FreeBSD:

    # XXX hack to get C++ standard library properly linked into shared
    object
    # $libs = append_library($libs, "supc++") # doesn't work
    if Config::CONFIG["arch"] =~ /-darwin\d/
    CONFIG['LDSHARED']="g++ -dynamic -bundle -undefined suppress -
    flat_namespace"
    else
    CONFIG['LDSHARED'] = "g++ -shared"
    end

    --Young
    Young Hyun, Nov 13, 2007
    #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. Replies:
    0
    Views:
    188
  2. Rudi Cilibrasi
    Replies:
    3
    Views:
    344
    Rudi Cilibrasi
    May 19, 2004
  3. Wes Gamble
    Replies:
    4
    Views:
    141
  4. Christophe Mckeon

    mkmf extconf include path

    Christophe Mckeon, Mar 29, 2007, in forum: Ruby
    Replies:
    7
    Views:
    130
    Daniel Berger
    Mar 29, 2007
  5. Replies:
    0
    Views:
    129
Loading...

Share This Page