From: Luis Lavena Date: 2010-11-09T03:06:33+09:00 Subject: Re: Using Ruby's C API safely and sanely On Nov 8, 1:45 pm, Eric MSP Veith wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello Rubyists! > > I'm trying to integrate Ruby (both for bindings and embedded interpreter) > into a larger project, namely RPM 5. I'm facing several diffuclties there > and hope that somebody might point out a more elegant way of solving things. > > First, querying Ruby's compile-time configuration is rather painful. RPM 5 > uses Autoconf, and using extconf.rb as yet another layer of configuration > seems not the best way. Currently, we're using calls to "ruby -rrbconfig -e > puts CONFIG::expand ..." to get information like CFLAGS/include directories, > location of Ruby's library directories, and so on. Is there a better way to > do this? Sadly, Ruby doesn't come with a .pc file or something similar, and > a call like Perl's "perl -V:..." doesn't seem to be implemented, either? > > Second, including the ruby.h file leads to the inclusion of Ruby's config.h > file. This is clearly not appreciated, as we need to cope with a lot of > HAVE_FOO_H defines, or even Ruby's PACKAGE_NAME, etc. definitions which of > course override RPM's. Is there a sane way of using Ruby's C API, i.e. > including the Ruby header file, without having Ruby wreak havok on our own > defines? > > Thanks alot in advance. Every hint is greatly appreciated. > Ruby trunk includes a package configuration file. You should checkout trunk and use it as base of your project. -- Luis Lavena