LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I run a C executable from UNIX in LabVIEW?

I am currently writing a feedback controlled genetic algorithm in C on UNIX and I was wondering if I produced an executable, could this be used in LabVIEW?
 
I would be recieving a current through LabVIEW, the C code would then read the signal, modify it, and then send a signal out again.
 
How would I go about incorporating this C executable into a VI?
 
Thanks
 
Alan Homer
 
0 Kudos
Message 1 of 9
(3,633 Views)
System Exec.vi  in Connectivity/Libraries & Executables. This will execute the executable and return its stdio output after terminating. If you need to interactively work with your executable you could use the pipe functions to communicate through your executables stdio interface WHILE the executable works.
If you need even more interactive control of your executable from LabVIEW the best bet would be to create a shared library instead and call it through the Call Library Node.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 9
(3,618 Views)
Thanks
 
0 Kudos
Message 3 of 9
(3,604 Views)
Sorry, I should have said, the code is coming from a UNIX executable but the LabVIEW v.7.1 that I am using is the Windows based package. Does that make a difference to my approach?
0 Kudos
Message 4 of 9
(3,603 Views)
The difference is, that you usually can't run an UNIX executable on Windows. LabVIEW or no LabVIEW...
0 Kudos
Message 5 of 9
(3,596 Views)
I have a suggestion but I am going to make some assumptions as I don't know your system but I have an idea how it might work.
 
If you had these things
 
1. NI Internet Toolkit
2. Telnet server on your unix box
3. FTP server on your unix box.
4. Command line version of your unix_app.exe
 
you should be able to do this
 
1. Generate your data from you pc labview application and save the results to file.
2. Get your labview application to ftp (put) your data file to the directory as unix_app.exe on your unix box.
3. In your labview app telnet to the unix box and change directory to where your unix_app.exe
4. In your telnet session run you unix_app.exe to read the labview result file and return the result to unix console or save unix_app_result file.
5. Parse the results in you Labview application. If the unix_app produces a results file you would ftp (get) to transfer the file back to your PC.
 
Does this help at all?
 
David
0 Kudos
Message 6 of 9
(3,584 Views)
You implied in your original message that you have the C code. If that's the case you should just recompile it under Windows. What is preventing you from doing this?
0 Kudos
Message 7 of 9
(3,578 Views)
I can't compile it under windows because when I do it claims the library file clib.lib or clib.h does not exist.
0 Kudos
Message 8 of 9
(3,574 Views)
That's just the standard C library. Have you tried changing your build setting to remove the explicit link to that library and just using the standard Windows C library?

If you post the source code as a zip file I can take a whack at trying to compile it for you.


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