From: elbows@... (Nathan Weston) Date: 2002-02-02T08:35:15+09:00 Subject: Extending Ruby in C++ I am trying to write a ruby extension in C++ (specifically, a wrapper around a small subset of the KDE libraries). I found a few related threads on this group, and as far as I can tell I am following their suggestions, but I am having very strange problems. I have some C code that sets up the extension, with an Init_Kde function that does all the rb_define_method and rb_define_class stuff. I link this with a separate C++ file that looks something like this: extern "C" { VALUE kapp_new(VALUE self) { KApplication *k = new KApplication(...) Data_Wrap_Struct(...) ... } } The C++ file is compiled with g++, the C file with gcc, and they are linked together (along with the KDE and ruby libraries). When I use this extension I get a segmentation fault on the call to the KApplication constructor. If I take the same code and place it in the main function of a C++ program, it works fine. Any suggestions? Thanks, Nathan