|
newbie problem with python lists as c-function arguments: msg#00175programming.swig
Hi, I want to wrap the following function for python: test.h: #-------------------------------- #include <map> #include <vector> #include <valarray> #include <list> #include <math.h> #include <stdio.h> double Calcvalues ( const int*, const int, const double*, const int, const int, const double*, double*, double*); #--------------------------------- test.i: #--------------------------------- %module test %{ #include "test.h" %} %include "carrays.i" %include "cpointer.i" %include "test.h" #--------------------------------- compiles to _test.dll usetest.py: #--------------------------------- import test a=[1,2,3] b=5 c=[1.0,2.0] etc..... print test.Calcvalues(a,b,c....) Error message: TypeError: Type error. Expected _p_int #--------------------------------- I have tried converting all lists to Numeric.arrrays, but this didn't work either. What's wrong? The second thing is that I actually not only want to get the return value, but also pass two empty lists (the last two arguments) that are filled within the function. I know that I have read somewhere what to do in this case, but I don't find it any more. Any help is really appreciated. Thanks marcus _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | SWIG - Memory leak: 00175, Mathieu Tremblay |
|---|---|
| Next by Date: | SWIG - Memory leak: 00175, David Beazley |
| Previous by Thread: | RE: How to wrap func (std::vector<std::string> &foo)i: 00175, Indi Chen (RD-TW) |
| Next by Thread: | double function returns wrong results (newbie): 00175, Gour |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |