LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Compilation

Hi There,
 
I'm a bit of a newbie to Labview having recently moved from C based languages, I'm using V8.5 Full development system.  I currently have a bit of a problem and was wondering if someone could give me some pointers towards the solution.
 
I have a Labview project that is a user interface and control for a piece of equipment we are about to launch.  Some of the control functions are performed by calling third party communication dll's.  I have been asked to provide a cut down version of this code as a User interface demo. I'd like to provide this without having to distribute the DLL's so how do can I set my project to build to not link in the DLL's? 
 
This is what I'd do in C.  Is it cool to post 'C' on a Labview forum.... or will the Data flow police be sent round to have a word with me? Smiley Wink
 
#define FULL_VERSION
 
#ifdef  FULL_VERSION
    FunctionThatCallsDll();
#else
    FunctionThatDoesntCallDll();
#endif
 
Thanks In advance
 
Derek
 
 
0 Kudos
Message 1 of 6
(3,673 Views)
Derek,


@Dereklogitech wrote:
[...]or will the Data flow police be sent round to have a word with me? Smiley Wink


BUSTED 🙂


I think the best structure for your desire is the "disable structure". Just disable the part of your code which should not be executed. Here an extraction of the help:
"Disabling Sections of Block Diagrams
You can run a VI with a section of the block diagram disabled, similar to commenting out a section of code in a text-based programming language. [...]"


hope this helps,
Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 6
(3,668 Views)

I don't remember the details, since those structures are basically available only in 8.x, which I don't have, but I think that more accurately, what you want is the conditional disable structure.

This allows you to define a condition in your project (similar to the #define statement) and thus switch the code in all the disable structures in the project at the same time from FULL_VERSION to DEBUG.


___________________
Try to take over the world!
Message 3 of 6
(3,661 Views)

Thank you... that's just what I was looking for.

I've now set a symbol in my project called DEMO. Everywhere the DLLs are called now has a conditional disable in it  When DEMO == True the code that calls the DDL's are disabled.

 

Thanks to you both for taking the time to help me. Smiley Happy

 

 

0 Kudos
Message 4 of 6
(3,645 Views)
It's cool to post 'C' code here, as long as you want to replace it with 'G' 😉


Regards,


Wiebe.
0 Kudos
Message 5 of 6
(3,615 Views)
I've been waiting for LabVIEW to catch up with conditional compilation that's been in text based languages seemingly forever.  Finally, I can develop and run my code at home completely independent of any hardware using simulated data, then go to work, change one symbol, and start running with the hardware all with the same ease as changing one line of "C" code. Maybe I'll make schedule now....Smiley Wink
0 Kudos
Message 6 of 6
(3,590 Views)