Created
February 26, 2012 00:55
-
-
Save DouglasAllen/1911968 to your computer and use it in GitHub Desktop.
an example for using inline gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#note: do not use *.rb for shell execution. Copy and rename to "ruby_inline_c". | |
require 'rubygems' | |
require 'inline' | |
class Example | |
inline(:C) do |builder| | |
builder.c "int method_test1() { | |
int x = 10; | |
return x; | |
}" | |
end | |
end | |
p Example.new.method_test1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am very much interested in using ruby extensions in my code because I want to learn how to access
my alsa for my debian system. Could I use Timidity libs as well? I want to get some midi tunes running
live using ruby.
Thanks in advance.