Hi Andrew:

It looks like the

%begin %{...%}

swig directive is an even slicker answer than the -include FILE gcc
option, see below.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

---------- Forwarded message ----------
Date: Thu, 8 Sep 2011 13:47:42 -0700 (PDT)
From: Alan W. Irwin <ir...@beluga.phys.uvic.ca>
To: Stefan Zager <sza...@gmail.com>
Cc: swig-u...@lists.sourceforge.net
Subject: Re: [Swig-user] How to #include your own header before the #includes
     that swig generates?

On 2011-09-08 10:36-0700 Stefan Zager wrote:

> This part of the documentation describes how to control where your
> code gets injected into the output:
> 
> http://www.swig.org/Doc2.0/SWIG.html#SWIG_nn40
> 
> Hope that helps.

Thanks, Stefan.  That helps a lot.  We are still using swig-1.3.x, but
the same useful code insertion documentation appears at
http://www.swig.org/Doc2.0/SWIG.html#SWIG_nn40

To be specific it appears

%{
#include "our_header.h"
%}

will put that #include in the header block (since %{...%} is shorthand
for %header %{...%}).  That was too late a position in the code, but
apparently earlier possibilities for code insertion are available as
well with, e.g.,

%begin %{
#include "our_header.h"
%}

Note I haven't yet had a chance to try this, but from the documentation
it should be perfect for our needs.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to