extconf.rb >> mkmf

K

K. R.

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!
 
Y

Young Hyun

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top