LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to single-threaded DLL from multiple EXEs?

Solved!
Go to solution

I am testing a device via SPI using an Aardvark (USB-SPI). The Aardvark's API is a single-threaded DLL.

 

I want to interface 2 (or more) programs across that SPI channel. For example, one program is an automatic test sequencer, and the second program is a manual register debugger.

 

If I run both programs from the development environment, everything works. The programs share the API handle, and calls from either program will go out to the device.

 

If I create an EXE from both programs, the two programs run as separate Windows applications, so they can't share the API handle, so only one program can use the device. Switching ownership means closing the handle in one, opening in the other, and re-initializing.

 

What are some approaches to make this DLL accessible from both applications when they're built as an EXE?

0 Kudos
Message 1 of 7
(2,634 Views)

Hi dan,

 

create a 4rd tool acting as server. This server tool will handle all the API access and provide it's service using network communication.

 

You other tools ("clients") can send send requests to the server and get the responses sent by the server…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,625 Views)

Hi Gerd,

 

Thanks, that sounds workable. If you've done this before, is there a problem with overhead/performance of the approach? I'm not familiar using LabVIEW as a server. Do you mean 1 server program is hosting TCP/IP on localhost, and both client programs connect to it? Or does LabVIEW have other mechanisms to connect applications?

 

Regards,

Dan

0 Kudos
Message 3 of 7
(2,603 Views)
Solution
Accepted by OneOfTheDans

Hi Dan,

 

Do you mean 1 server program is hosting TCP/IP on localhost, and both client programs connect to it?

Yes.

You can also use UDP, if this ok for you…

 

Or does LabVIEW have other mechanisms to connect applications?

Yes.

Like said before UDP, but also other things like NetworkSharedVariables or NetworkStreams. On VIPM you also find implementations like STM…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,591 Views)

That's exciting, I will research these more and try to implement one to solve my problem. Thanks for all your help!

0 Kudos
Message 5 of 7
(2,582 Views)

It would seem simpler to have one exe that contains both programs in one application.

0 Kudos
Message 6 of 7
(2,559 Views)

On the surface, that's definitely easiest. But the automated test sequencer is quite large. Some users only need the sequencer, some only need the debugger, and some need both. So I'm hoping to keep the programs as independent tools. That way I can modify & release the smaller debug tool without touching the validated test sequence.

0 Kudos
Message 7 of 7
(2,512 Views)