LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

linux windows porting

Hi All!

I'd like to do development for my main project on Linux, mainly because of the ease of use of some window managers in comparison to Windows; what I'm after is an easy way of seperating some implementations in the same way as I'd do it in C++ for example (write a header and maintain two different source files with platform-dependant implementations). Is there any way to do this? Eg, is there a way to tell Labview (using 7.1) through a config file or so, "If you're on windows, use this vi, if you're on linux, use this vi".
I only have very few incompatible vi's, but they are the only thing holding me back from doing all development on a Linux box..

Thanks in advance.
0 Kudos
Message 1 of 3
(2,977 Views)
You can place down a Property Node anywhere in your code and select the property called Application >> Target >> Operating System. This will output at Run-Time the operating system where your code is running. You can wire the output of this property node into a Case Structure and then execute the correct subVI based on the operating system.

You will probably have to do some more work than this. It's entirely possible that your Linux subVI will have a broken run arrow in Windows if it tries to call a shared library or do anything Linux-specific. In that case it won't be enough to try to put it in a case structure, since your main app won't be able to run if any of its subVIs are broken. In that case, you will need to call your platform-specific VIs dynamically using VI Server based on the current operating system. That means LabVIEW won't decide which VIs to load until run-time, so you can only load the correct implementation.

On a side note, LabVIEW 8.x has a nice feature that makes this much easier. There are new nodes that resemble Case Structures called Conditional Disable Structures that operate much like an #ifdef statement in C. You can set them up to only compile code in one case based on a number of different symbols such as the operating system or custom symbols you create. You can have broken wires or broken subVIs in the disabled cases and your application can still run. Using this method, you could set up your application to switch automatically based on the environment that loads it without dynamically calling your VIs.
Jarrod S.
National Instruments
Message 2 of 3
(2,973 Views)
thanks for the fast reply.
I have indeed a vi that calls win32 specific stuff (namely wsock32.dll to setup tcp options), so I'll try the VI server option.
Interesting tip about Labview8, the conditional case disable you described is exactly what I was looking for!
0 Kudos
Message 3 of 3
(2,965 Views)