python, swig and typemaps..

Grzegorz Dostatni grzegorz at ugrad.cs.ualberta.ca
Fri Mar 9 01:03:11 EST 2001


Hello... 
I've got a problem with swig and typemaps.  What I'm trying to do is to
have a c subroutine working on some data.  I'd love to pass the data into
c just as a char* (that's what it is).  The problem is it is full of
zeroes (so c null-terminated string will not work very well...)  The best
way would be to have a it so that from python I can call:
example("Hello")
and swig will call the corresponding c function as 
void example(char*, int size).  If that's not possible it's ok to pass in
the size of the string. ie python:
example( "Hello", len("Hello"))
when I'm allocating the char *, how do I get the other parameter (ie
size?)...

Thanx a lot..
Grzegorz Dostatni


########################################################################
The world is full of people who have never, since childhood, met an
open doorway with an open mind.
                -- E.B. White

Chemistry is physics without thought.
Mathematics is physics without purpose.

"If you want to know what God thinks about money, just look at the people
He gives it to." 
-- Old Irish Saying 





More information about the Python-list mailing list