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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using HW-access in executable

Hello,

i created a C#-DLL to communicate to a DIO-module using modbus (over LAN).

The DLL-functions are called in separate VIs.

Finally this vi´s are called in my GUI and everything runs fine when executing in Developer-Mode.

But after creating an executable of it the DI is not reading anything any more.

What can be the problem here?

 

After start of the program i run an initialize-vi for the DIO-module that creates a reference as return-value. This reference is saved in a global-VI-variable.

Is it possible that there are problems with global variables in executable?

 

Thanks for tips

0 Kudos
Message 1 of 6
(2,394 Views)

Globals work fine in executables, can your code report errors that might occur whne openning the references?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 6
(2,382 Views)
But be aware that they are not shared across different executables.
0 Kudos
Message 3 of 6
(2,379 Views)

Hi,

 

have you tried to debug the executable?

 

Philipp K.

AE | NI Germany

0 Kudos
Message 4 of 6
(2,350 Views)

Solved.

I checked the error-output of the read-vi that said the given reference is null.

The solution was that the Application-builder only copied the DLL that is used in the VI and not the DLL that is referenced in the driver-dll.

So the structure is:

readDI.vi calls myhardware.dll calls modbus.dll.

 

And the last modbus.dll was not copied by the builder.

Now i manually copied this dll into the data-directory and everything works.

 

Is there a setting in the builder to copy this dll?

 

Thx

 

0 Kudos
Message 5 of 6
(2,339 Views)

have you tried to add the dll to the project an choosing the option "allways include" for this file? Is it necessary for the dll, that it is copied to a system folder?

 

When you are using an installer there are several possibilities:

1. adding the additional files to the project in a folder( for example supported files). you can select a destination folder for every single file.

2. executing another file after installation(another installer, batch file which copies the files to selected folder)

 

Kind Regards,

 

Philipp K.

AE | NI Germany

0 Kudos
Message 6 of 6
(2,327 Views)