LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reuse code

Hi,

 

I hope someone can help.

 

I am using CVI for the first time almost (5 years since I did any coding) but now all round there is python code and some functions would be good to use again.

 

Is it possible to reuse this python code and if so how?

 

Thanks

Simon

 

 

 

0 Kudos
Message 1 of 3
(3,590 Views)

CVI is C-based, Python is an OO language unlike C.

 

There is Cython, which is C generated from Python, so you could take your Python code, automaticaly generate Cython from it, then try and compile that in the CVI environment.

 

Or, if you can build a DLL from Python, you could call it from your CVI application.

 

Or, if your Python code can be made into  a stand alone application , you could invoke it (schedule it) from C code written as a CVI project.

 

Menchar

0 Kudos
Message 2 of 3
(3,569 Views)

To clarify -

 

See www.cython.org

 

Cython is Python with support for C data types.

 

You can invoke Python/Cython from C very essily, according to the Cython wiki here:

 

http://wiki.cython.org/FAQ

 

I'd say leave the Python code as Python if possible, and call it however Cython describes.  If that doesn't work, convert the Python to Cython and then call the Cython from C.

 

Menchar

0 Kudos
Message 3 of 3
(3,567 Views)