Hello,
I'm getting a "test.rb:46: stack level too deep (SystemStackError)"
when defining three or more functions for a module, which is created
& given to Ruby via the Ruby C API. The test.rb (actually
"trunk/src/samp/test.rb") file and the remaining source code is
available in a Subversion repository here:
svn checkout -r21 svn://rubyforge.org/var/svn/ruby-vpi
- -or-
<http://rubyforge.org/plugins/scmsvn/viewcvs.php/?root=ruby-vpi&pathrev=21>
In particular, the error occurs when I register a third module
function with Ruby C API inside line 25 of the file
"trunk/src/RVPI.cin":
// register the VPI module
RVPI__rModuleDef = rb_define_module("VPI");
rb_define_module_function( // first func
RVPI__rModuleDef
, "relay_verilog"
, RVPI_rb_relay_verilog
, 0
);
rb_define_module_function( // second func
RVPI__rModuleDef
, "register_task"
, RVPI_rb_register_task
, 1
);
rb_define_module_function( // third func
RVPI__rModuleDef
, "handle_by_name"
, RVPI_rb_handle_by_name
, 2
); // FIXME: causes "stack level too deep (SystemStackError)"
I originally thought the problem was with the third module function
(named "RVPI_rb_handle_by_name") that I was trying to register. But
this was not the case, because the SystemStackError occurred even
when I registered the first module function under a different name:
// register the VPI module
RVPI__rModuleDef = rb_define_module("VPI");
rb_define_module_function( // first func
RVPI__rModuleDef
, "relay_verilog"
, RVPI_rb_relay_verilog
, 0
);
rb_define_module_function( // second func
RVPI__rModuleDef
, "register_task"
, RVPI_rb_register_task
, 1
);
rb_define_module_function( // first func with different name
RVPI__rModuleDef
, "foo"
, RVPI_rb_relay_verilog
, 0
);
What am I doing wrong?
Thank you.