LabVIEW DLL Guide

Have you ever been thinking that some task could be done quicker or better in C/C++/C#? But then due to project requirements or other constraints, you had to code it all again in LabVIEW. Don’t waste your time again! If there is anything that can be done easier in another programming language – just do it and then use the code as a shared library in LabVIEW.

DLLs are sections of code that are linked to the main program at run time (dynamically linked). This has several advantages. The first is space. If many applications share a certain algorithm, you can compile it once as a DLL, and then use the same code in all the applications. DLLs also provide a way for code to be distributed in a fashion that easily allows higher level programs to access the code. A good example of this are hardware drivers, in which the interface between the application software and the hardware is often through a DLL.

 

Knowing how to include C# libraries into a LabVIEW project can be a very useful tool. There are many reasons why you would want to include C# DLL’s into a LabVIEW project but the two that come up most often for me is reusing legacy code that was initially written in C# and writing a C# wrapper when wanting to use a third party driver or library. Sometimes it’s easier to write the wrapper in C# and then implement the library directly in LabVIEW. When interfacing directly to a third party driver/library, the LabVIEW code to accomplish a relatively simple task can be very messy and cumbersome to read; hence the C# wrapper with simple implementation in LabVIEW being my preferred method.

Thank you for reading my blog post, for an more in depth guide to using DLL in LabVIEW checkout this link. If you are interested in making a project using this tool but don’t have the right supplies, you can purchase a copy of LabVIEW 2014 home edition and everything you will need to run LINX 3.0 and start making! Please comment below with any questions or comments you may have.

Author

Be the 1st to vote.

2 Comments on “LabVIEW DLL Guide”

  1. Hi,

    Maybe I missed it in your post, but does DLL stand for “dynamically linked library”? Also, could you use a DLL for other coding languages besides C, C++, and C#? I.e., could I use a DLL for Verilog or VHDL if I wanted to? I guess they don’t have libraries per se, but maybe something like Java then?

  2. A dll does indeed stand for Dynamic Linked Library. Unfortunately it is only used by conventional coding languages. It is in essence compiled “CPU instructions”. This means a vhdl or verilog compiler wouldn’t know how to translate it into logical gates. Due to this you can’t use it on the FPGA. You can however use it on the CPU of for example a Zynq chip.

Leave a Reply to Natsu Cancel reply

Your email address will not be published. Required fields are marked *