More examples
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@491 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b3e124ac21
commit
e560c1d445
10 changed files with 326 additions and 41 deletions
74
Examples/perl5/index.html
Normal file
74
Examples/perl5/index.html
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>SWIG:Examples:perl5</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
<H1>SWIG Perl Examples</H1>
|
||||
|
||||
<tt>$Header$</tt><br>
|
||||
|
||||
<p>
|
||||
The following examples illustrate the use of SWIG with Perl.
|
||||
|
||||
<ul>
|
||||
<li><a href="simple/index.html">simple</a>. A minimal example showing how SWIG can
|
||||
be used to wrap a C function and a global variable.
|
||||
<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 Perl extension, SWIG is run with the following options:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% swig -perl5 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 -perl5 interface.i
|
||||
% gcc -fpic -c -Dbool=char -I/usr/lib/perl5/5.00503/i386-linux/CORE interface_wrap.c
|
||||
% gcc -shared interface_wrap.o $(OBJS) -o interface.so
|
||||
% perl
|
||||
use interface;
|
||||
...
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<li>The politically "correct" way to compile a Perl extension module is to use MakeMaker
|
||||
and related tools (especially if you are considering third-party distribution). Consult
|
||||
a book such as Advanced Perl Programming for details.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2>Compatibility</h2>
|
||||
|
||||
The examples have been extensively tested on the following platforms:
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li>Linux
|
||||
<li>Solaris
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Due to wide variations in the Perl C API and differences between versions such as the ActivePerl release for Windows,
|
||||
the code generated by SWIG is extremely messy. We have made every attempt to maintain compatibility with
|
||||
many Perl releases going as far back as 5.003 and as recent as 5.6. However, 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>.
|
||||
Better yet, send us a patch.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue