From: Daniel Harple Date: 2006-08-09T05:32:34+09:00 Subject: Using C++ Member Function with rb_protect I'm having problems using a C++ member function with rb_protect. Here is the code: class Sandbox { public: Sandbox() { sandbox_ = rb_funcall(rb_const_get(rb_cObject, rb_intern ("Sandbox")), rb_intern("safe"), 0); } virtual ~Sandbox() { } VALUE eval(char * code) { int status = 0; VALUE val = rb_protect(&Sandbox::eval_protect, rb_str_new2(code), &status); if (status) { /* handle error... */ } return val; } private: VALUE eval_protect(VALUE code) { return rb_funcall(sandbox_, rb_intern("eval"), 1, code); } VALUE sandbox_; }; The compile fails with: test.cpp: In member function �VALUE Sandbox::eval(char*)�: test.cpp:18: error: cannot convert �VALUE (Sandbox::*)(VALUE)� to �VALUE (*)(VALUE)� for argument �1� to �VALUE rb_protect(VALUE (*) (VALUE), VALUE, int*)� $ ruby1.8 -v ruby 1.8.5 (2006-08-06) [powerpc-darwin8.7.0] $ g++ --version powerpc-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5341) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Any ideas? Thanks, -- Daniel