From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

How to use dll in Labview ?

Solved!
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
(7,948 Views)

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
(7,908 Views)

Now I can use dll with labview. but I can't create dll with VC++2010. I try to study with this tutorial http://www.youtube.com/watch?v=I0uGEJKcyik but Labview not found any function in my dll. How to create dll for Labview

0 Kudos
Message 3 of 4
(7,900 Views)
Solution
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: http://zone.ni.com/devzone/cda/tut/p/id/4877. Basically you need to prepend extern "C" in front of your prototypes in your header files. I would also suggest reviewing this article: https://decibel.ni.com/content/docs/DOC-14564.

0 Kudos
Message 4 of 4
(7,883 Views)