From: Torsten Robitzki Date: 2012-06-29T20:24:45+09:00 Subject: C++ extension using boost Hello, I'm trying to create a ruby extension with a library that uses boost. This little example #include extern "C" void Init_bayeux() { boost::regex expression("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"); } 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. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin10/4.5.2/lto-wrapper Target: x86_64-apple-darwin10 Configured with: ../gcc-4.5.2/configure --prefix=/opt/local --build=x86_64-apple-darwin10 --enable-languages=c,c++,objc,obj-c++,fortran,java --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-gxx-include-dir=/opt/local/include/gcc45/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --enable-stage1-checking --disable-multilib --enable-fully-dynamic-string Thread model: posix gcc version 4.5.2 (GCC) I elaborated already on the issue (see http://stackoverflow.com/questions/11224096/unable-to-create-a-c-ruby-extension 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 Torsten -- Posted via http://www.ruby-forum.com/.