Ruby debugger

Page 39

Ruby Debugger

4. Create a test file: To test your extension you can create a test file in the same folder. An example of the test file: require “myext”

Save it as test.rb. 5. Run the test.rb from the terminal: ruby test.rb

Output: Hello Ruby from C!

B. The second way : 1. Add the extension in the ext folder in the source code. 2. Inside the extension, create a new file called “depend” which represents the dependencies folder that the ruby will use to check for the header files. 3. Add the following line inside extconf.rb $INCFLAGS << " -I$(topdir) -I$(top_srcdir)"

"ex: ruby -I<directory>" and send it to the $INCFLAGS environment variable which is set in the make file and the topdir and topsrcdir environment variables after that is automatically set during ruby compilation 4. Recompile Ruby from the terminal. 5. Use the ruby file in your source code path to run ruby from the terminal. 32 | P a g e


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.