From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Disable based on whether code is executing from a pre-compiled Packed Project Library?

Solved!
Go to solution

Conditional Disable diagram structure allows one to fork code paths, for example based on whether or the development environment or run-time engine is executing the code. 

 

Is there any way to do this based on whether the executing code is contained in a Packed Project Library or a traditional library/project?

 

0 Kudos
Message 1 of 6
(679 Views)
Solution
Accepted by Nate@UT

This isn't a conditional disable structure, but just a case structure based on whether you are in a PPL or not so you can achieve the same thing.

ShockHouse_0-1697810959537.png

 

Message 2 of 6
(664 Views)

Thanks!  I was too caught-up with the Conditional Disable structure and figuring out how to do this with "compiler flags" and didn't even think to look for a traditional run-time based approach.  

0 Kudos
Message 3 of 6
(658 Views)

You can also do it like this:

paul_a_cardinale_0-1697815650299.png

When no VI reference is wired, it defaults to the current VI.

0 Kudos
Message 4 of 6
(621 Views)

Interestingly, when code is running from within a PPL, the built-in RUN_TIME_ENGINE flag used for Conditional Disable structures always evaluates to "False" regardless of whether or not one is running in the LV Dev Environment or in a compiled application under the Run-Time Engine.  

Configuring Conditions for Conditional Disable Structures - NI

 

Is this a LabVIEW bug? or by-design?   It seems to make logic using the RUN_TIME_ENGINE flag useless from PPLs.  (Note, I am using LabVIEW 2023 Q3 64-bit)

0 Kudos
Message 5 of 6
(610 Views)

Nate@UT wrote:

Interestingly, when code is running from within a PPL, the built-in RUN_TIME_ENGINE flag used for Conditional Disable structures always evaluates to "False" regardless of whether or not one is running in the LV Dev Environment or in a compiled application under the Run-Time Engine.  

Configuring Conditions for Conditional Disable Structures - NI

 

Is this a LabVIEW bug? or by-design?   It seems to make logic using the RUN_TIME_ENGINE flag useless from PPLs.  (Note, I am using LabVIEW 2023 Q3 64-bit)


Fiddling with this atm.

 

The conditional disabled case doesn't (can't) change after a compile. So the fact it's always the same is expected.

 

When it's compiled, it's unclear if it's run time engine or not. For an exe, this is clear: the result will always run in the RTE. But PPLs can be used in the development environment.

 

So, I think it's just a choice.

 

However, I'd like a condition to switch between code compiled in a ppl and code in a vilib.

 

In my use case I can't use the case structure. I want a dynamically loaded DLL in development of the vilib, so I can actually compile the DLL. When I build the PPL, I'd like a static link to the DLL so the DLL is copied to the PPL, and included in executables that use the PPL.

 

That trick does work when compiling an exe, but not for a PPL.

 

The case solution doesn't change what is compiled, so that won't work in this situation.

 

Adding the DLL to the build spec doesn't work, as to compile the DLL it is deleted, and the build spec automatically removes it...

 

I just can't win...

 

EDIT: I can win! I can make my own conditional symbol, and use a pre-build action to set it when building a PPL (and reset it in a post build action). *sigh*

0 Kudos
Message 6 of 6
(203 Views)