Update examples to recommend compiling with -fPIC instead of -fpic

To reflect previous change to swig defaults.
This commit is contained in:
matoro 2024-07-22 17:46:29 -04:00
parent e89960a53f
commit 16129d9804
5 changed files with 7 additions and 7 deletions

View File

@ -72,10 +72,10 @@ rather than <tt>gccgo</tt>.
named <tt>example.a</tt>; e.g., <tt>gopack grc example.a example.6
example_gc.6</tt>.
<li>Compile the <tt><a href="example_wrap.c">example_wrap.c</a></tt>
file using your standard C compiler with the <tt>-fpic</tt> option;
e.g., <tt>gcc -c -O -fpic example_wrap.c</tt>.
file using your standard C compiler with the <tt>-fPIC</tt> option;
e.g., <tt>gcc -c -O -fPIC example_wrap.c</tt>.
<li>Also compile the actual code, not generated by SWIG; e.g., <tt>gcc
-c -O -fpic example.c</tt>.
-c -O -fPIC example.c</tt>.
<li>Put the gcc compiled object files into a shared library;
e.g., <tt>gcc -shared -o example.so example_wrap.o example.o</tt>.
<li>Compile the program which demonstrates how to use the library;

View File

@ -42,7 +42,7 @@ 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 -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;

View File

@ -44,7 +44,7 @@ the steps look like this (Linux):
<blockquote>
<pre>
% swig -python interface.i
% gcc -fpic -c interface_wrap.c -I/usr/local/include/python1.5
% gcc -fPIC -c interface_wrap.c -I/usr/local/include/python1.5
% gcc -shared interface_wrap.o $(OBJS) -o interfacemodule.so
% python
Python 1.5.2 (#3, Oct 9 1999, 22:09:34) [GCC 2.95.1 19990816 (release)] on linux2

View File

@ -45,7 +45,7 @@ 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 -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'

View File

@ -44,7 +44,7 @@ the steps look like this (Linux):
<blockquote>
<pre>
unix % swig -tcl interface.i
unix % gcc -fpic -c interface_wrap.c -I/usr/local/include
unix % gcc -fPIC -c interface_wrap.c -I/usr/local/include
unix % gcc -shared interface_wrap.o $(OBJS) -o interface.so
unix % tclsh8.3
% load ./interface.so