|
naive question about passing in a NULL via Python: msg#00179programming.swig
Hello, I apologize if the answer to my question is readily available. I have looked at the 1.3 development documentation but I have not found what I need. I am using SWIG 1.3.17 and Python 2.2.2. Suppose I have this simple C function declaration: void myfunc(char *mystring); The code has one branch if mystring points to a standard null-terminated string, but follows a different branch if mystring is (the usual C) NULL, ie. if ( mystring == NULL ){ do something;} else { do different;} What is the most "elegant", "easy" and "proper SWIG" way to have this function wrapped so that in Python I can simply do import mymodule mymodule.myfunc(<something>) and have the C code called with mystring == NULL? I think it would be "natural" to call in Python mymodule.myfunc(None) and have the None be passed to the C as a NULL. Is there a straightforward way to do that? Thank you for your time. Scott _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: swig and perl580 and sun solaris compiler 5.3: 00179, David Beazley |
|---|---|
| Next by Date: | typemaps for python lists (double,int) as function arguments: 00179, Marcus Stojek |
| Previous by Thread: | SWIG - Memory leaki: 00179, Mathieu Tremblay |
| Next by Thread: | typemaps for python lists (double,int) as function arguments: 00179, Marcus Stojek |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |