Tutorial by Examples

C extensions are comprised of two general pieces: The C Code itself. The extension configuration file. To get started with your first extension put the following in a file named extconf.rb: require 'mkmf' create_makefile('hello_c') A couple of things to point out: First, the name hell...
In order to be able to work with C structs as Ruby objects, you need to wrap them with calls to Data_Wrap_Struct and Data_Get_Struct. Data_Wrap_Struct wraps a C data structure in a Ruby object. It takes a pointer to your data structure, along with a few pointers to callback functions, and returns a...
RubyInline is a framework that lets you embed other languages inside your Ruby code. It defines the Module# inline method, which returns a builder object. You pass the builder a string containing code written in a language other than Ruby, and the builder transforms it into something that you can ca...

Page 1 of 1