At Tue, 20 Jun 2000 16:33:55 +0200,
Robert Feldt <feldt / ce.chalmers.se> wrote:
> > There's no difference between C and C++ in writing extension, except
> > you have to wrap initialize function (Init_xxx) by extern "C".
> > 
> When I make the file below gcc won't compile it since ANSI C++ does not 
> allow pointer conversion. I guess one solution is to turn the ANSI C++
(snip)
> extern "C" void Init_rubycpp() {
>   cFunc = rb_define_class("Func", rb_cObject);
>   rb_define_method(cFunc, "f", rbcpp_f, 1);
>   rb_define_method(cFunc, "initialize", rbcpp_init, 0);
> }

How about casting the type of the function
into (VALUE (*)(...)) explicitly, for example:

#define RB_METHOD(func) ((VALUE (*)(...))func)
extern "C" void Init_rubycpp() {
  cFunc = rb_define_class("Func", rb_cObject);
  rb_define_method(cFunc, "f", RB_METHOD(rbcpp_f), 1);
  rb_define_method(cFunc, "initialize", RB_METHOD(rbcpp_init), 0);
}
-- 
Takaaki Tateishi <ttate / jaist.ac.jp>