From: Paul Wuersig Date: 2010-01-25T04:19:45+09:00 Subject: Invoking Ruby 1.9.1 interpreter within C, on OS X gcc As part of a project, I'm trying to set up a system that can run Ruby scripts (with C functionality) from C. I did this rather easily on 1.8.7 Ruby, but this version is built into my version of SnowLeopard, so it's as simple as a #include. I built 1.9.1 from source and installed it to /usr/local, but I'm having difficulties including everything I need while compiling the C code that should set up and run the interpreter. Here's test.c: #include #include "ruby.h" int main(int argc, char **argv) { ruby_sysinit(&argc, &argv); { RUBY_INIT_STACK; ruby_init(); return ruby_run_node(ruby_options(argc, argv)); } } Here's how I'm trying to compile it: gcc -I/usr/local/include/ruby-1.9.1/ruby test.c It complains about undefined symbols for all the ruby calls. I think I'm missing a pointer to the necessary libraries, but I'm not sure which directory to point to. Documentation seems scant for this (obviously rare) usage: my basis for the 1.8.7 interpreter embedding was an example, which I cannot find for the equivalent 1.9.1 case. Any help or advice would be greatly appreciated. Thanks, Paul -- Posted via http://www.ruby-forum.com/.