[Python.NET] How to use a Python function that returns a double array in VB vie C++
Pieter Steenekamp
pieters at randcontrols.co.za
Wed Dec 3 08:51:21 CET 2008
Hi all,
I want to use a Python function that returns a double array in VB dot net
via embedding Python in C++ dot net. Using the CLR it is easy to access C++
from VB. Then also I don't have a problem if the Python function returns a
single variable of type double, using the following lines in my C++ code:
myPythonObjectPointer = PyObject_CallObject(pFunc, pArgs);
myCppDoubleVariable = PyFloat_AsDouble(myPyObjectPointer);
(I have obviously done all the required thingies as per the Python
documentation)
I can further achieve what I want by changing the Python function to a
number of functions, each returning a single double variable and call them
one by one, using code like above, and then passing them into an array in
C++, but I would prefer a more elegant way of doing it, because my return
variable could have hundreds, if not thousands, of values.
Can somebody help me please.
Thanks
Pieter Steenekamp.
More information about the PythonDotNet
mailing list