summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorWayne Meissner <wmeissner@gmail.com>2008-12-26 09:11:00 +1000
committerWayne Meissner <wmeissner@gmail.com>2008-12-26 09:11:00 +1000
commit2575195b277580e875e9108df0a80f8e42c0147a (patch)
tree4bb40b01419339e86bbdbd283dff7afa1c585398 /samples
parent1f0fbe151426cee03684b5fd38767fa174804ace (diff)
downloadffi-2575195b277580e875e9108df0a80f8e42c0147a.tar.gz
Build the extension lib in build/#{RUBY_VERSION} so multiple versions can be built in the one tree
Diffstat (limited to 'samples')
-rw-r--r--samples/hello.rb3
-rw-r--r--samples/sample_helper.rb6
2 files changed, 7 insertions, 2 deletions
diff --git a/samples/hello.rb b/samples/hello.rb
index 5a6aa0c..30deda4 100644
--- a/samples/hello.rb
+++ b/samples/hello.rb
@@ -1,5 +1,4 @@
-require 'rubygems'
-require 'ffi'
+require File.expand_path(File.join(File.dirname(__FILE__), "sample_helper"))
module Foo
extend FFI::Library
attach_function("cputs", "puts", [ :string ], :int)
diff --git a/samples/sample_helper.rb b/samples/sample_helper.rb
new file mode 100644
index 0000000..2bac44f
--- /dev/null
+++ b/samples/sample_helper.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+require 'spec'
+
+$:.unshift File.join(File.dirname(__FILE__), "..", "lib"), File.join(File.dirname(__FILE__), "..", "build", RUBY_VERSION) unless RUBY_PLATFORM =~ /java/
+require "ffi"
+