From: Newb Newb Date: 2009-04-20T19:06:40+09:00 Subject: Help on Ruby Segmentation Problem hi all.. I extend ruby with C. I m new to these kind of stuffs... I integrate my dll namely prov.all into C program namely prov.c afterthat i call those c functions through ruby . irb(main):001:0> require 'prov1' => true irb(main):002:0> include Prov => Object irb(main):003:0> Prov::load => true irb(main):004:0> Prov::init_engine (irb):4: [BUG] Segmentation fault ruby 1.8.6 (2007-03-13) [i386-mswin32] when i call Prov::init_engine method it gets crashed. could you pls point me out which causes segmentation Problem. Thanks in advance. below is my prov1.c code #include "windows.h" #include "ruby.h" #include "prov.h" #define _D(string) {OutputDebugString(string);} VALUE Prov; void _textline(const char *s, int len) //************************************ { _D(s); } static VALUE p_load(VALUE self ) //****************************** { prov_load(); return Qtrue; } static VALUE p_init(VALUE self) //***************************** { _D("-> init"); prov_set_textline_callback(_textline); prov_renderInit(); //return Qtrue; } static VALUE p_parse(VALUE self, VALUE string_to_parse) //***************************************************** { _D(StringValuePtr(string_to_parse)); return prov_parse(StringValuePtr(string_to_parse)); } static VALUE pr_render( VALUE self ) //********************************** { _D("-> render"); prov_render(0); //return Qtrue; } void Init_prov1() //*************** { Prov = rb_define_module( "Prov" ); rb_define_method(Prov, "load", p_load, 0); rb_define_method( Prov, "init_engine", p_init, 0 ); rb_define_method(Prov, "parse", p_parse, 1); rb_define_method(Prov, "render", pr_render, 0); } -- Posted via http://www.ruby-forum.com/.