Discussion:
[Python.NET] How to use a Python function that returns a double array in VB vie C++
Pieter Steenekamp
2008-12-03 07:51:21 UTC
Permalink
Received: from localhost (HELO bag.python.org) (127.0.0.1)
by bag.python.org with SMTP; 03 Dec 2008 09:08:44 +0100
X-policyd-weight: using cached result; rate: -7.6
X-Greylist: delayed 902 seconds by postgrey-1.27 at bag.python.org;
Wed, 03 Dec 2008 09:08:44 CET
Received: from blue.cozahost.com (blue.cozahost.com [74.53.60.228])
by bag.python.org (Postfix) with ESMTP
for <pythondotnet-+ZN9ApsXKcEdnm+***@public.gmane.org>; Wed, 3 Dec 2008 09:08:44 +0100 (CET)
Received: from dsl-243-71-138.telkomadsl.co.za [41.243.71.138] by
blue.cozahost.com with SMTP; Wed, 3 Dec 2008 09:51:31 +0200
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
X-BeenThere: pythondotnet-+ZN9ApsXKcEdnm+***@public.gmane.org
X-Mailman-Version: 2.1.10
Precedence: list
List-Id: "A list for users and developers of Python for .NET"
<pythondotnet.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/options/pythondotnet>,
<mailto:pythondotnet-request-+ZN9ApsXKcEdnm+***@public.gmane.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/pythondotnet>
List-Post: <mailto:pythondotnet-+ZN9ApsXKcEdnm+***@public.gmane.org>
List-Help: <mailto:pythondotnet-request-+ZN9ApsXKcEdnm+***@public.gmane.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/pythondotnet>,
<mailto:pythondotnet-request-+ZN9ApsXKcEdnm+***@public.gmane.org?subject=subscribe>
Sender: pythondotnet-bounces+gcpd-pythondotnet=m.gmane.org-+ZN9ApsXKcEdnm+***@public.gmane.org
Errors-To: pythondotnet-bounces+gcpd-pythondotnet=m.gmane.org-+ZN9ApsXKcEdnm+***@public.gmane.org
Archived-At: <http://permalink.gmane.org/gmane.comp.python.dotnet/857>

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.




_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
http://mail.python.org/mailman/listinfo/pythondotnet

Loading...