From: Simon Strandgaard <0bz63fz3m1qt3001@...> Date: 2002-10-15T21:00:41+09:00 Subject: extensions in C++ (iostream) Has anyone experience with or knows how to get iostream working? I have searched, but not found any results. I would realy appreciate it. Thanks in advance Simon Strandgaard here is my files -------------------------------------------------------- # "test.rb" require 'Test' name = Test.getname print "name=",name,"\n" -------------------------------------------------------- // "test.cpp" #include "ruby.h" #include //#include VALUE get_name(VALUE self) { char *name = "hello world"; cout << "test" << endl; //printf("test\n"); return rb_str_new2(name); } typedef VALUE (*HOOK)(); extern "C" void Init_Test() { VALUE test = rb_define_module("Test"); rb_define_module_function(test, "getname", (HOOK)get_name, 0); } -------------------------------------------------------- # "extconf.rb" require 'mkmf' create_makefile("Test") -------------------------------------------------------- ruby/ext> ls extconf.rb test.cpp test.rb ruby/ext> ruby extconf.rb creating Makefile ruby/ext> make c++ -fPIC -O -pipe -fPIC -I. -I/usr/local/lib/ruby/1.6/i386-freebsd4 -I. -c -o test.o test.cpp cc -shared -Wl,-soname,Test.so -L/usr/local/lib -o Test.so test.o -L. -lruby -lc ruby/ext> ruby test.rb test.rb:1:in `require': ./Test.so: Undefined symbol "endl__FR7ostream" - ./Test.so (LoadError) from test.rb:1 ruby/ext> --------------------------------------------------------