Showing results for 
Search instead for 
Did you mean: 

How to use dll in Labview ?

Go to solution

I compile this code to dll file with VC++2010 filename is test_dll.dll .


#include "stdafx.h"
#include <iostream>
#include <Windows.h>

using namespace std;
int main(int a){
    cout << "Test dll...............\n";

    return a;


After that, I put Call Library Function node in editor and double click Call Library Function node. I browse test_dll.dll into Library name or path and set function prototype to int32_t main(int32_t a); but it show error Call Library Function Node 'test_dll.dll:main':function not found in libraly. How to use dll in Labview ?  And I have more question is what is differrent from Tools -> Import -> Shared Library(.dll) and use Call Library Function node.

0 Kudos
Message 1 of 4

Hi mmc01, 


First, you may want to start with this tutorial, which shows how to call a simple C/C++ DLL from LabVIEW. If after going through this document, you still receive the same error, you can check out this resource, which provides solutions for this error. Hope this helps! 

Julianne K
Systems Engineer, Embedded Systems
Certified LabVIEW Architect, Certified LabVIEW Embedded Systems Developer
National Instruments
0 Kudos
Message 2 of 4

Now I can use dll with labview. but I can't create dll with VC++2010. I try to study with this tutorial but Labview not found any function in my dll. How to create dll for Labview

0 Kudos
Message 3 of 4
Accepted by topic author mmc01

The issue you are having is that LabVIEW is not capable of using C++ DLLs directly. It only handles C DLLs. This does not mean that if you you cannot use the DLL if it's compiled with the C++ compiler as opposed to the C compiler. Rather, it means that you must take extra steps in order to use it from LabVIEW. The primary issue is that of name mangling or adornment. This is discussed here: Basically you need to prepend extern "C" in front of your prototypes in your header files. I would also suggest reviewing this article:

0 Kudos
Message 4 of 4