[SciPy-user] Wrapping C libraries for Numeric integration

Scott Ransom sransom at nrao.edu
Tue Feb 7 12:30:22 CST 2006


I'm a bit hesitant to post this since the code is a bit old and possibly a 
bit crusty, but I have several typemaps that I've been using successfully 
for the past ~6yrs that allow me to do some interfacing of 1-D and 2-D 
arrays between C and Numeric. 

What I have allows me to use a C function on an array generated in Numeric, 
as well as turn an array that was created in C (with malloc) into a usable 
Numeric array.

Some of the maps are pretty specific to my code, but if there is enough 
interest (and if someone is willing to check things out wrt the new numpy), 
I would be willing to post the typemaps and maybe some usage examples.

Scott

PS:  These typemaps are the same ones I announced several years ago on the 
numeric mailing list(s).

On Tuesday 07 February 2006 06:07, Bryan Cole wrote:
> Hi All,
>
> What's the best approach for wrapping C libraries where the
> inputs/outputs are C arrays (which I want to pass to/from Numeric
> arrays)?
>
> I'm a regular SWIG user, but I don't have any typemaps to handle
> C-array-to-Numeric conversion and I can't see any distributed with SWIG.
> What approach is used by SciPy? (I know scipy is mostly fortran routines
> but surely you have a few C ones?).
>
> Can anyone point me to existing typemaps for this purpose, to save me
> writing my own.
>
> thanks,
> Bryan
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

-- 
Scott M. Ransom            Address:  NRAO
Phone:  (434) 296-0320               520 Edgemont Rd.
email:  sransom at nrao.edu             Charlottesville, VA 22903 USA
GPG Fingerprint: 06A9 9553 78BE 16DB 407B  FFCA 9BFA B6FF FFD3 2989



More information about the SciPy-user mailing list