C++ extension using boost

I’m trying to create a ruby extension with a library that uses boost.
This little example

#include <boost/regex.hpp>

extern “C” void Init_bayeux()

results in a std::bad_cast exception being thrown, when loaded into the
ruby interpreter. I used the mac port installation of the gcc to build
the extension and installed ruby via rvm.

ruby -v
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin10.8.0]

gcc -v
Using built-in specs.
Target: x86_64-apple-darwin10
Configured with: …/gcc-4.5.2/configure --prefix=/opt/local
–libdir=/opt/local/lib/gcc45 --includedir=/opt/local/include/gcc45
–infodir=/opt/local/share/info --mandir=/opt/local/share/man
–datarootdir=/opt/local/share/gcc-4.5 --with-local-prefix=/opt/local
–with-system-zlib --disable-nls --program-suffix=-mp-4.5
–with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local
–enable-stage1-checking --disable-multilib
Thread model: posix
gcc version 4.5.2 (GCC)

I elaborated already on the issue (see

for details) but found no way to build a shared library, that links to
boost and can be successfully loaded by the ruby interpreter.

Is there someone out who was able to build a ruby extension, that uses
boost? Any help and pointers are highly appreciated.

best regards