Add support for the Go programming language.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12108 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
09f14197ac
commit
5af2978f77
259 changed files with 16159 additions and 14 deletions
89
Examples/go/index.html
Normal file
89
Examples/go/index.html
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>SWIG:Examples:Go</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
<H1>SWIG Go Examples</H1>
|
||||
|
||||
<p>
|
||||
The following examples illustrate the use of SWIG with Go.
|
||||
|
||||
<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.
|
||||
<li><a href="variables/index.html">variables</a>. An example showing how to access C global variables from Go.
|
||||
<li><a href="enum/index.html">enum</a>. Wrapping enumerations.
|
||||
<li><a href="class/index.html">class</a>. Wrapping a simple C++ class.
|
||||
<li><a href="reference/index.html">reference</a>. C++ references.
|
||||
<li><a href="pointer/index.html">pointer</a>. Simple pointer handling.
|
||||
<li><a href="funcptr/index.html">funcptr</a>. Pointers to functions.
|
||||
<li><a href="template/index.html">template</a>. C++ templates.
|
||||
<li><a href="callback/index.html">callback</a>. C++ callbacks using directors.
|
||||
<li><a href="extend/index.html">extend</a>. Polymorphism using directors.
|
||||
</ul>
|
||||
|
||||
<h2>Compilation Issues</h2>
|
||||
|
||||
<ul>
|
||||
<li>To create a Go extension, SWIG is run with the following options:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% swig -go interface.i
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<li>On Unix the compilation of examples is done using the
|
||||
file <tt>Example/Makefile</tt>. This makefile performs a manual
|
||||
module compilation which is platform specific. When using
|
||||
the <tt>6g</tt> or <tt>8g</tt> compiler, the steps look like this
|
||||
(GNU/Linux):
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% swig -go interface.i
|
||||
% gcc -fpic -c interface_wrap.c
|
||||
% gcc -shared interface_wrap.o $(OBJS) -o interfacemodule.so
|
||||
% 6g interface.go
|
||||
% 6c interface_gc.c
|
||||
% gopack grc interface.a interface.6 interface_gc.6
|
||||
% 6l program.6
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<li>When using the <tt>gccgo</tt> compiler, the steps look like this:
|
||||
|
||||
<blockquote>
|
||||
<pre>
|
||||
% swig -go interface.i
|
||||
% gcc -c interface_wrap.c
|
||||
% gccgo -c interface.go
|
||||
% gccgo program.o interface.o interface_wrap.o
|
||||
</pre>
|
||||
</blockquote
|
||||
|
||||
</ul>
|
||||
|
||||
<h2>Compatibility</h2>
|
||||
|
||||
The examples have been extensively tested on the following platforms:
|
||||
|
||||
<ul>
|
||||
<li>GNU/Linux
|
||||
</ul>
|
||||
|
||||
All of the examples were last tested with the following configuration
|
||||
(10 May 2010):
|
||||
|
||||
<ul>
|
||||
<li>Ubuntu Hardy
|
||||
<li>gcc-4.2.4
|
||||
</ul>
|
||||
|
||||
Your mileage may vary. If you experience a problem, please let us know by
|
||||
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue