[Matrix-SIG] SWIG with recent NumPy

Rob Managan managan@llnl.gov
Mon, 13 Dec 1999 12:11:31 -0800

>I'm trying to use SWIG to automatically wrap some C routines and
>return the results as NumPy arrays (converting from my own pet vector
>structure.)  I have typemaps that worked with old versions of NumPy,
>but now I have had to insert a call to "import_array()" by hand in the
>SWIG-generated C module in the module initialization section.
>This means (AFAIK) that I have to hand-patch the C every time I run
>SWIG.  That's bad.  Is there any way to get SWIG to insert the needed
>"import_array()" call automatically?  Also, are there standard NumPy
>SWIG typemaps?
>Lots of questions, as ususal.  ;-)

I was about to start looking into this myself. Could you send me a 
copy of the typemaps so I can see if I can use them? I will be 
getting to this after the holidays.

  I think that what you want for the "import _array()" is the %init %{ 
... %} option in SWIG. It claims that code you insert in this block 
will be added to the initialization routine.

Rob Managan       <mailto://managan@llnl.gov>
LLNL                      ph:  925-423-0903
P.O. Box 808, L-095       FAX: 925-422-3389
Livermore, CA  94551-0808