I am trying to wrap some C code I have. Currently I have something like...
defs.h ----------- typedef unsigned long MY_DIGIT; myapp.c ------------- void MakeDigits(MY_DIGIT digits[]) { .... } char* GetString(char *inMessage, MY_DIGIT *digit) { char *results; ... ... return results; } ...ok so my interface for swig looks like.. %module MyApp %{ #include "math.h" %} extern void MakeDigits(MY_DIGIT digits[]); extern char* GetString(char *inMessage, MY_DIGIT *digit); %include "cpointer.i" %pointer_functions(MY_DIGIT, digit_array); %include "cmalloc.i" %malloc(int); %free(int); ...Ok, so I have a couple questions. 1) How would I call MakeDigits from python? In the C code I would normally have something like... MY_DIGIT tmp[10]; MakeDigits(tmp); 2) How would I call GetString? Again, in C I would have... char *ptr; char msg[100] = "Hello World"; MY_DIGIT x = 98; ptr = GetString(msg, x); 3) Did I define MY_DIGIT correctly in my SWIG interface file? 4) If I try the following Python code... x = new_digit_array() print x then Python.exe dies...any idea? thanks for the help. I am trying to find my answers int he SWIG docs...either i haven't found it or I didn't understand when I came across it. thanks in the mean time. -- http://mail.python.org/mailman/listinfo/python-list