Last update July 11, 2004

Dwith Swig /
More About Swig

Table of contents of this page
Conditional action in the interface file   


This is to give more information about SWIG as it is needed for the understanding of the use of SWIG for D. These are features of SWIG which have not been modified for D.

Conditional action in the interface file    

It is possible to maintain a single header file for a particular C or C++ source, which can be run for different target languages. SWIG supports a lot of target languages e.g. Tcl, ruby, perl. For each of them there is a defined constant which can be used to include or exclude code depending on the target language.

  • for D it is SWIGDMD
Example from /Examples/Pragma

// Protection so that it is only seen when using dmd.
#ifdef SWIGDMD
%pragma(dmd) classimports="private import classA;"


For full documentation on SWIG (other than for D) see SWIG.


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: July 11, 2004 10:43 (diff))