From: William F. <wsf...@us...> - 2004-07-23 22:09:09
|
Update of /cvsroot/swig/SWIG/Doc/Manual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3837/Doc/Manual Modified Files: Advanced.html Log Message: Update with regard runtime library Index: Advanced.html =================================================================== RCS file: /cvsroot/swig/SWIG/Doc/Manual/Advanced.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Advanced.html 10 Jul 2004 16:39:31 -0000 1.5 --- Advanced.html 23 Jul 2004 22:08:48 -0000 1.6 *************** *** 60,64 **** public: a(); ! ~a(); void foo(double); }; --- 60,64 ---- public: a(); ! virtual ~a(); void foo(double); }; *************** *** 142,150 **** </pre></blockquote> <p> ! Now, run SWIG and compile as follows:<p> <p> <blockquote><pre> % <b>swig -c -tcl mytclsh.i</b> ! % <b>gcc mytclsh_wrap.c -I/usr/local/include -L/usr/local/lib -ltcl -lswigtcl8 -ldl -lm \ -o tclsh</b> </pre></blockquote> --- 142,150 ---- </pre></blockquote> <p> ! Now, assuming you have built the <a href="Modules.html">runtime library</a> as <tt>swigruntcl</tt>, run SWIG and compile as follows:<p> <p> <blockquote><pre> % <b>swig -c -tcl mytclsh.i</b> ! % <b>gcc mytclsh_wrap.c -I/usr/local/include -L/usr/local/lib -ltcl -lswigruntcl -ldl -lm \ -o tclsh</b> </pre></blockquote> *************** *** 158,162 **** % <b>ld -shared example_wrap.o -o example.so</b> </pre></blockquote> ! Linking against the <tt>swigtcl8</tt> library is no longer necessary as all of the functions are now included in the <tt>tclsh</tt> executable and will be resolved when your module is loaded. However, some operating systems, like Windows, will still require linking with the libraries so that there are no unresolved symbols.<p> <p> --- 158,162 ---- % <b>ld -shared example_wrap.o -o example.so</b> </pre></blockquote> ! Linking against the <tt>swigruntcl</tt> library is no longer necessary as all of the functions are now included in the <tt>tclsh</tt> executable and will be resolved when your module is loaded. However, some operating systems, like Windows, will still require linking with the libraries so that there are no unresolved symbols.<p> <p> *************** *** 169,173 **** % <b>gcc -shared example_wrap.o -o libexample.so</b> # Linux % <b>ld -G example_wrap.o -o libexample.so</b> # Solaris ! > <b>cl /LD example_wrap.obj /o example.dll swigtcl8.lib tcl83.lib /link /LIBPATH:c:\SWIG\Runtime /LIBPATH:c:\Tcl\lib</b> # Windows VC++ </pre></blockquote> --- 169,174 ---- % <b>gcc -shared example_wrap.o -o libexample.so</b> # Linux % <b>ld -G example_wrap.o -o libexample.so</b> # Solaris ! > <b>cl /LD example_wrap.obj /o example.dll swigruntcl.lib tcl83.lib ! /link /LIBPATH:PathToRuntimeLibrary /LIBPATH:c:\Tcl\lib</b> # Windows VC++ </pre></blockquote> *************** *** 184,191 **** <p> <blockquote><pre>% <b>setenv LD_LIBRARY_PATH .:/home/beazley/packages/lib</b></pre></blockquote> ! A somewhat better approach is to link your module with the proper path encoded. This is typically done using the `<tt>-rpath</tt>' or `<tt>-R</tt>' option to your linker (see the man page). For example:<p> <p> <blockquote><pre>% <b>ld -shared example_wrap.o example.o -rpath /home/beazley/packages/lib \ ! -L/home/beazley/packages/lib -lswigtcl8.so -o example.so</b> </pre></blockquote> The <tt>-rpath</tt> option encodes the location of shared libraries into your modules and gets around having to set the <tt>LD_LIBRARY_PATH</tt> variable.<p> --- 185,192 ---- <p> <blockquote><pre>% <b>setenv LD_LIBRARY_PATH .:/home/beazley/packages/lib</b></pre></blockquote> ! A somewhat better approach is to link your module with the proper path encoded. This is typically done using the `<tt>-rpath</tt>' or `<tt>-R</tt>' option to your linker on Unix (see the man page). For example:<p> <p> <blockquote><pre>% <b>ld -shared example_wrap.o example.o -rpath /home/beazley/packages/lib \ ! -L/home/beazley/packages/lib -lswigruntcl.so -o example.so</b> </pre></blockquote> The <tt>-rpath</tt> option encodes the location of shared libraries into your modules and gets around having to set the <tt>LD_LIBRARY_PATH</tt> variable.<p> |