PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 6ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/Root-branch-php-utl/SWIG/Examples/perl5/index.html

#
HTML | 100 lines | 76 code | 24 blank | 0 comment | 0 complexity | 0660102b02ddc6afa43fcb920a880925 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1<html>
  2<head>
  3<title>SWIG:Examples:perl5</title>
  4</head>
  5
  6<body bgcolor="#ffffff">
  7<H1>SWIG Perl Examples</H1>
  8
  9<tt>$Header$</tt><br>
 10
 11<p>
 12The following examples illustrate the use of SWIG with Perl.
 13
 14<ul>
 15<li><a href="simple/index.html">simple</a>.  A minimal example showing how SWIG can
 16be used to wrap a C function and a global variable.
 17<li><a href="constants/index.html">constants</a>.  This shows how preprocessor macros and
 18certain C declarations are turned into constants.
 19<li><a href="variables/index.html">variables</a>.  This example shows how to access C global variables from Perl.
 20<li><a href="value/index.html">value</a>. How to pass and return structures by value.
 21<li><a href="class/index.html">class</a>. How to wrap a simple C++ class.
 22<li><a href="reference/index.html">reference</a>. C++ references.
 23<li><a href="pointer/index.html">pointer</a>. Simple pointer handling.
 24<li><a href="funcptr/index.html">funcptr</a>. Pointers to functions.
 25</ul>
 26
 27<h2>Compilation Issues</h2>
 28
 29<ul>
 30<li>To create a Perl extension, SWIG is run with the following options:
 31
 32<blockquote>
 33<pre>
 34% swig -perl5 interface.i
 35</pre>
 36</blockquote>
 37
 38<li>The compilation of examples is done using the file <tt>Example/Makefile</tt>.  This
 39makefile performs a manual module compilation which is platform specific.  Typically,
 40the steps look like this (Linux):
 41
 42<blockquote>
 43<pre>
 44% swig -perl5 interface.i
 45% gcc -fpic -c -Dbool=char -I/usr/lib/perl5/5.00503/i386-linux/CORE interface_wrap.c
 46% gcc -shared interface_wrap.o $(OBJS) -o interface.so 
 47% perl
 48use interface;
 49...
 50</pre>
 51</blockquote>
 52
 53<li>The politically "correct" way to compile a Perl extension module is to use MakeMaker
 54and related tools (especially if you are considering third-party distribution).  Consult
 55a book such as Advanced Perl Programming for details.
 56
 57</ul>
 58
 59<h2>Compatibility</h2>
 60
 61The examples have been extensively tested on the following platforms:
 62
 63<p>
 64<ul>
 65<li>Linux
 66<li>Solaris
 67</ul>
 68
 69Please see the <a href="../../Doc/Manual/Windows.html">Windows</a> page in the main manual for information on using the examples on Windows. <p>
 70
 71The most recent version of Perl used for testing is as follows:
 72
 73<blockquote>
 74<pre>
 75% perl -version
 76This is perl, v5.6.0 built for sun4-solaris
 77
 78Copyright 1987-2000, Larry Wall
 79
 80Perl may be copied only under the terms of either the Artistic License or the
 81GNU General Public License, which may be found in the Perl 5.0 source kit.
 82
 83Complete documentation for Perl, including FAQ lists, should be found on
 84this system using `man perl' or `perldoc perl'.  If you have access to the
 85Internet, point your browser at http://www.perl.com/, the Perl Home Page.
 86</pre>
 87</blockquote>
 88
 89<p>
 90Due to wide variations in the Perl C API and differences between versions such as the ActivePerl release for Windows,
 91the code generated by SWIG is extremely messy.  We have made every attempt to maintain compatibility with
 92many Perl releases going as far back as 5.003 and as recent as 5.6.  However, your mileage may vary.
 93If you experience a problem, please let us know by 
 94contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
 95Better yet, send us a patch.
 96
 97</body>
 98</html>
 99
100