|
SWIG - Memory leak: msg#00176programming.swig
Mathieu Tremblay writes: > Hi there, I have a problem with a very simple extended swig function. > I'll try to make this as short as possible so here it is: > > In my C Code, I define the following: > typedef float REAL32; > > I want to export a C function to swig that has the following prototype: > void somefunction(REAL32 param1); > > Lets say my module is called : mymodule, in python I cant call write the > following code: > import mymodule > mymodule.somefunction(1.0) > because it is telling me that I pass the wrong argument type. So I > created a simple typecasting function that maps a float to a REAL32, > even if it is casting to the same type (float = REAL32), > Did you tell SWIG about the typedef? There should be no need to write special functions, converters, or anything like that to make this work. > > Is it because I do something wrong? Is there another way of doing this ? > It's leaking memory because you didn't tell SWIG what a REAL32 is (the typedef). See http://www.swig.org/Doc1.3/SWIG.html#n19 http://www.swig.org/Doc1.3/SWIG.html#n23 -- Dave _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | newbie problem with python lists as c-function arguments: 00176, Marcus Stojek |
|---|---|
| Next by Date: | Re: swig and perl580 and sun solaris compiler 5.3: 00176, John Lenz |
| Previous by Thread: | SWIG - Memory leaki: 00176, Mathieu Tremblay |
| Next by Thread: | naive question about passing in a NULL via Python: 00176, Scott Koranda |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |