
Let me redefine my question please. I get that `exc_message` is static as it's defined only to by visible to `rb_define_method` in the same file. I suppose then accessing this function from anywhere else is not possible without modifying ruby's source code, and that's not what I want. In stead I took a look at how `exc_message` is implemented. ``` c return rb_funcallv(exc, idTo_s, 0, 0); ``` Now, what is `idTo_s`? It's not accessible from my code and I can't find the [definition][1] of it. [1]: https://github.com/search?q=repo%3Aruby/ruby%20idTo_s&type=code Daniel Sierpiński
Sent: Saturday, June 08, 2024 at 7:04 PM From: "Daniel Sierpinski via ruby-talk" <ruby-talk@ml.ruby-lang.org> To: ruby-talk@ml.ruby-lang.org Cc: "Daniel Sierpinski" <siery@comic.com> Subject: [ruby-talk:444502] Accessing error.c symbols from the ruby C library
I have compiled ruby 3.2.2 vm using gcc with the following command:
``` gcc -std=c23 -o test test.c -g -Wall -Wextra -Woverflow -Og -pedantic -Wno-unused-parameter -I/home/user/.rbenv/versions/3.2.2/include/ruby-3.2.0 -I/home/user/.rbenv/versions/3.2.2/include/ruby-3.2.0/x86_64-linux -L/home/user/.rbenv/versions/3.2.2/lib -Wl,-rpath,/home/user/.rbenv/versions/3.2.2/lib -lruby ```
This works for the most part (I can successfully init the vm and run ruby code). Though, when I tried to handle ruby exceptions within my C code I find out that the `exc_message(VALUE exc)` is a static symbol inside [error.c][1]. I can not see it being exported anywhere.
Is there something more then ruby.h header that I need to include to access this function from C?
[1]: https://github.com/ruby/ruby/blob/69c0b1438a45938e79e63407035f116de4634dcb/e...
Daniel Sierpiński