From: Scott Gonyea Date: 2010-11-09T06:09:33+09:00 Subject: Re: Using Ruby's C API safely and sanely You should give some thought to using FFI. It'll work in ruby, rubinius, and jruby. Sent from my iPhone On Nov 8, 2010, at 8:45 AM, 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. > > Eric > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAkzYI6wACgkQhS0drJ3goJJVPwCeO/DMR6sGbg777cfjBrwoz8f/ > GNcAn1fvmTOkwzXOgNHhzS7u8FkStJ0s > =KNRE > -----END PGP SIGNATURE----- >