14 Aug 2002 14:39
Re: calling target language from C; multilanguage extensions
lyle <at> knology.net <lyle <at> knology.net>
2002-08-14 12:39:56 GMT
2002-08-14 12:39:56 GMT
On Wed, 14 Aug 2002 02:28:31 -0400 (EDT), Peter Amstutz
<tetron <at> interreality.org> wrote :
> My second question is about dealing with typemaps for various languages.
> Right now I have all my typemaps written for Perl at the top of my
> interface file, but I'd like to write an equivilent set of typemaps for
> other languages (guile scheme for example). How can I specify to SWIG
> which set of typemaps to use, based on the target language?
I don't know if this is deprecated, since I don't see it mentioned in the
updated SWIG documentation, but instead of writing a typemap like this:
%typemap(in) MySpecialType {
/* feh */
}
you can specify the target language for a typemap:
%typemap(perl, in) MySpecialType {
/* do it the Perl way */
}
%typemap(python, in) MySpecialType {
/* do it the Python way */
}
Another way would be to use SWIG preprocessor directives. Depending on the
language for which SWIG is generating code, it will define a preprocessor
symbol (e.g. SWIGPERL or SWIGPYTHON) that you can check for:
(Continue reading)
RSS Feed