Extconf.rb >> mkmf

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!

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