Add Ruby support contributed by Masaki Fukushima.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@518 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
263818929b
commit
4d989f6796
39 changed files with 3754 additions and 10 deletions
85
SWIG/Examples/ruby/index.html
Normal file
85
SWIG/Examples/ruby/index.html
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
<head>
|
||||
<title>SWIG:Examples:ruby</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
<H1>SWIG Ruby Examples</H1>
|
||||
|
||||
<tt>$Header$</tt><br>
|
||||
|
||||
<p>
|
||||
The following examples illustrate the use of SWIG with Ruby.
|
||||
|
||||
<ul>
|
||||
<li><a href="simple/index.html">simple</a>. A minimal example showing how SWIG can
|
||||
be used to wrap a C function, a global variable, and a constant.
|
||||
<li><a href="constants/index.html">constants</a>. This shows how preprocessor macros and
|
||||
certain C declarations are turned into constants.
|
||||
</ul>
|
||||
|
||||
<h2>Compilation Issues</h2>
|
||||
|
||||
<ul>
|
||||
<li>To create a Ruby extension, SWIG is run with the following options:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% swig -ruby interface.i
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<li>The compilation of examples is done using the file <tt>Example/Makefile</tt>. This
|
||||
makefile performs a manual module compilation which is platform specific. Typically,
|
||||
the steps look like this (Linux):
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% swig -ruby interface.i
|
||||
% gcc -fpic -c interface_wrap.c -I/usr/local/lib/ruby/1.4/i686-linux
|
||||
% gcc -shared interface_wrap.o $(OBJS) -o interface.so
|
||||
% ruby
|
||||
require 'interface'
|
||||
Interface.blah(...)
|
||||
...
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<li>The politically "correct" way to compile a Ruby extension is to follow the steps
|
||||
described <tt>README.EXT</tt> in Ruby distribution:
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li>Create a file called <tt>extconf.rb</tt> that looks like the following:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
require 'mkmf'
|
||||
create_makefile('interface')
|
||||
</pre>
|
||||
</blockquote>
|
||||
<li>Type the following to build the extension:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% ruby extconf.rb
|
||||
% make
|
||||
</pre>
|
||||
</blockquote>
|
||||
</ol>
|
||||
</ul>
|
||||
|
||||
<h2>Compatibility</h2>
|
||||
|
||||
The examples have been extensively tested on the following platforms:
|
||||
|
||||
<ul>
|
||||
<li>Linux
|
||||
</ul>
|
||||
|
||||
Your mileage may vary. If you experience a problem, please let us know by
|
||||
sending a message to <a href="mailto:swig-dev@cs.uchicago.edu">swig-dev@cs.uchicago.edu</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue