SystemStackError when rb_define_module_function() * 3

S

Suraj Kurapati

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.


## begin extra info ##

The test.rb (actually "samp/test.rb") file and the remaining source
code is available in a Subversion repository at RubyForge:

svn checkout -r21 svn://rubyforge.org/var/svn/ruby-vpi/trunk
- -or-
<http://rubyforge.org/plugins/scmsvn/viewcvs.php/trunk/?root=ruby-vpi&pathrev=21>

Also, I run "make ivl" inside the "samp/" directory to run the
sample test bench ("test.v" and "test.rb").

Finally, I am using this Ruby version:
ruby 1.8.3 (2005-06-23) [i486-linux]

## end extra info ##


In particular, the error occurs when I register a third module
function with Ruby C API inside line 25 of the file
"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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD9WgQmV9O7RYnKMcRAnv6AKCp2axs4vC3+n9h1vSmBIP7QL+ISgCdGH6X
U6pkTj3RoLSsPNj0dL1xVQg=
=18Ev
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SystemStackError when rb_define_module_function() * 3 3
[ANN] Ruby-VPI 7.0.0 0
[ANN] Ruby-VPI 7.3.0 0
[ANN] Ruby-VPI 0.9.1 0
[ANN] Ruby-VPI 0.7 2
[ANN] Ruby-VPI 0.8 0
[ANN] Ruby-VPI 0.8.1 0
[ANN] Ruby-VPI 0.9 0

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top