[mapserver-users] how does swig work?

Steve Lime steve.lime at dnr.state.mn.us
Thu Nov 14 13:19:34 EST 2002


Swig is used to write scripting language wrapper code automatically
from
existing C/C++ libraries. Swig creates the glue between C and the
language
of choice. This usually involves a C file written in the appropritiate
low level
language API (nasty, nasty stuff) and then some supporting files
written
in the scripting language itself. One could write these by hand and
most
languages give you the tools to do just that, but then you're limited
to
just that language. PHP/MapScript is maintained that way. Swig allows
you
to target multiple languages. Swig works off of an "interface" file
that
allows you to dictate how the resulting module will work. Check out
mapscript/mapscript.i in the MapServer distribution to see what we
wrote
for MapScript.

For distributions I run Swig (1.1.883) to generate language specific
files before the tar file is built. If you're using the CVS you'll need
to Swig
things yourself.

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> Puneet Kishor <pkishor at geoanalytics.com> 11/13/02 08:54PM >>>
Perl gurus,

I am trying to understand where swig comes into the picture. When I 
configure/make mapserver, a bunch of perlvars get generated. The 
Makefile.PL uses these perlvars to generate the make file. Where does 
swig come in the picture? I don't have swig on my machine. Is mapserver

already swigged?

I want to understand this because -- (1) for the heck of it; (2) 
experiment with new versions of swig (well, I really don't know what I

am talking about -- I really would like to experiment with the new 
version of perl 5.8.0, if possible.

Tia,

pk/




More information about the mapserver-users mailing list