From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reload source file after custom build step

Hello,
 
I use a source code generator that creates c-code (i.e. hello.c) from some kind of definition file.
I want the generator to create hello.c on each build, so i have decided to put a batch (that calls the generator) into the "custom build step" of my project.
This way the generator is called before each build.
 
Unfortunatly CVI does not reload the changed hello.c after it has been modified/overwritten by the batch... the build is done with the previous version of hello.c. Not until the build is finished CVI recognizes that hello.c has been modified and prompts "Update Window from Disk", then I have to run a second build in order to get the changes of hello.c applied.
 
How can I accomplish to have only build process that first calls the generator and then compiles the project (with modified hello.c)?
 
Thanks
0 Kudos
Message 1 of 3
(2,791 Views)
The problem happens because you have the file open in CVI. If a file is opened in CVI, then CVI uses the contents that are available in the opened window and not the contents on disk. Also, once CVI starts a build it does not monitor changes to the file on disk - consider what should happen if the file on disk changes while it is being compiled. So while the custom build step does overwrite the file on disk, CVI uses the contents that are in the source window for the compilation. To avoid this problem, make sure the file is not opened in CVI when you build - this will make CVI load and compile the file from disk after the custom build step overwrites it.
0 Kudos
Message 2 of 3
(2,773 Views)

I have actually the same problem, that I generate a source code file during custom build steps with script. The file is not open in the editor in order to avoid the refresh message of the editor. My file is then included in another c source code file.

Unfortunately I have the same problem, that I need two compiler runs, in the first one the changes in my generated file are not detected and compiled.

Has there been a change on the CVI environment since I am using the actual 2012 SP1 version ? Or any other suggestions ?

 

Thanks

0 Kudos
Message 3 of 3
(2,388 Views)