12-03-2010 03:37 PM
I am trying to use the System Exec VI to call a Labview exe file (Yes, I've already tried the DLL option, but I have other issues so this was the next best thing). I already know how to pass in arguments from the command line, but how can I output data (string format) from the exe through the System Exec VI's "Standard Output" terminal? Is there a setting anywhere? I didn't see anything in the invoke or property nodes.
12-06-2010 12:40 PM
Hi Trouble,
The Standard Output terminal will return information from the program you call as long as the wait until completion terminal is set to true. Wire a true constant to the wait until completion and the output of the program will be returned. If you don't wire a true constant to the terminal, the Standard Output will be a blank string.
Hope this helps,
Starla T.
12-06-2010 01:07 PM
I don't know how to make a LabVIEW created exe behave like a DOS program and write to the standard out.
You could write to a file inside the exe and then read the text in the calling VI.
Yes, I've already tried the DLL option, but I have other issues so this was the next best thing).
I have to ask what issues did you have with creating a DLL with LabVIEW as that would be the best way and would give you more control and flexibility. System Exec is good when there is a existing DOS program that you did not write but need. If your are the one creating the code, a DLL is the way to go.
12-06-2010 01:18 PM
This has been discussed before and I believe this Lava post gives an example of a VI that can write standard output to the commandline window that it was ran from.
http://lavag.org/topic/11719-running-a-labview-exe-from-the-console/page__view__findpost__p__71087
One suggestion in the next post in that thread was to use the command cmd /c myapp.exe when running the LabVIEW app.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-07-2010 08:55 AM
The problem I am having is the DLL crashing. I am trying to communicate with the sbRIO module using only two Network shared variables (send & receive). I simplified the VI in the DLL to its simplest form, and even though it ran longer, it did still crash. By crash, it either locks up Labview so that I need the task manager to kill it or labview just instantly disappears without warning. I can run an .EXE file all day, but the DLL will crash at random. I'm still working on the code located on the RT target and trying to optimize the performance there, but I'm not having much luck yet.
12-09-2010 11:02 AM
Are you building a LV vi into a dll and then calling it from LV? That sounds unusual...could you give us more detail on your application?
12-09-2010 12:23 PM
The DLL allows the code to be more portable and easier to program from an upper level. Also, since I am using the RT and FPGA applications, the development person using this code doesn't need the licenses, if I keep it as a subVI, then licenses are required.
Anyway, I think I figured out the root cause of my problem with the DLL. I am using Ethernet and the Network Shared Variables to communicate with the RT target (sbRIO). To do that I used a USB-Ethernet adapter on my PC since my only port is connected to the company network. Once I removed the adapter and connected directly to the back of the PC, the crashes went away. We are going to try adding a PCI-Ethernet card to the computer instead of the USB adapter to make sure that it will still work.
Thanks for the responses even though I don't think the original question was answered. I guess for now the answer is 'not possible' (at least until the next version of LV, right!?).
Jeff
12-09-2010 12:36 PM
Hoovahh - Sorry, I missed your response. I just checked out the example, very interesting. Not sure how I would implement it yet especially since I need a solution in 8.6 not 2009, although it looks basic enough to redo in 8.6. But since I think I solved my issue, it will have to wait for another day. Thanks for the response.
Jeff