Developer Center Resources

Showing results for 
Search instead for 
Did you mean: 

Tutorial: Configuring the Call Library Function Node to call a Simple DLL


» Calling External Code » Calling C/C++ DLLs » Call Library Function Node




This tutorial walks you through the process of dropping and configuring a Call Library Function Node to call a simple C/C++ DLL from LabVIEW.


For more details on the options in the Call Library Function Node configuration dialog, refer to:
LabVIEW Help: Configuring the Call Library Function Node

Example DLL

The attached sample DLL, PassingDataSampleDLL.dll, contains multiple functions including the following which we will use for this tutorial:
int PassingParameters_Integer (int x, int y)
This function returns the sum of the two numbers, x and y, that are passed as parameters.




  1. Open a new VI

  2. Switch to the block diagram
    (Window » Show Block Diagram)

  3. Drop in a Call Library Function Node
    (Functions Palette » Connectivity » Libraries & Executables » Call Library Function Node)

  4. Open the Configuration dialog for the Call Library Function Node
    (Right-click on the Call Library Function Node and click Configure… or double click on the Call Library Function Node)

  5. On the Function tab, click the Browse button next to the Library name or path and browse to the sample DLL, PassingDataSampleDLL.dll.

  6. This will populate the Function name dropdown box with the functions available in this DLL.

  7. Select the PassingParameters_Integer function from the Function name dropdown box.

  8. Your Function tab should look as follows. Note that the function prototype does not match what our function actually accepts. We will fix this in the next couple of steps.

  9. Switch over to the Parameters tab

  10. This function returns an integer (the sum), so set the return type to an Int32:

    1. Select return type from the parameter list on the left

    2. In the Current parameter section, pick Numeric from the Type dropdown box

    3. Leave the data type as the default – Signed 32-bit Integer

  11. This function takes in two integers as parameters, so add these as inputs:

    1. Click the Insert button to add a new parameter

    2. This will create a new parameter called arg1 that defaults to an Int32 passed by value. This is exactly what we want to leave the defaults.
      Note: You can rename the argument name if you would like, this will not affect the way the DLL is called.

    3. Repeat step 11.a to add another parameter, leave the defaults for this argument as well

  12. Your Parameters tab should look as follows. Note that the function prototype now matches the actual prototype of our function in the DLL.

  13. Click OK to close the configuration dialog

  14. Set up the front panel inputs and outputs for the Call Library Function Node

    1. Select the Call Library Function Node

    2. Click Ctrl+Space to bring up the Quick Drop menu

    3. Click Ctrl+D to automatically create controls and indicators for the inputs and outputs of the node

  15. Switch to the Front Panel
    (Window » Show Front Panel)

  16. Change the values for the controls arg1 and arg2, and click the Run button.

  17. Notice that the indicator return type 2 updates with the value returned from the DLL function, the sum of arg1 and arg2. (Your front panel may appear different)



Conclusion / Next Steps

You have learned how to call a C/C++ function in a DLL from LabVIEW using the Call Library Function Node. You can call more advanced functions as well using the Call Library Function Node by varying the options in the Call Library Function Node’s configuration dialog.


The Import Shared Library Wizard can automate a lot of the effort involved in calling C/C++ DLLs by creating wrapper VIs with configured Call Library Function Nodes that you can call from your VIs.
Tutorial: Creating Wrapper VIs for C/C++ DLL functions using the Import Shared Library Wizard


For examples on how to configure the Call Library Function Node to handle more complex datatypes, refer to:
Calling C/C++ DLLs Containing Simple and Complex Datatypes from LabVIEW



Jervin Justin
NI TestStand Product Manager
Download All

After step 5 I get the following error:

The library selected is not valid for the current platform. For example, you are running 64-bit LabVIEW and the library might be a 32-bit library.


I am indeed running a 64-bit LabVIEW. Is there also a 64-bit version of the sample DLL 'PassingDataSampleDLL.dll' or does there exists a workaround?

Knight of NI Knight of NI
Knight of NI

Nothing prevents you from also installing LabVIEW 32bit and use that. I guess that's a "workaround". 😄

(Of course somebody having the source code of the dll could compile it for 64bit.)


Is there any particular reason you absolutely need 64bit? 



I want to automate the process in using MAXIM max17312 EV kit software.

I have some DLL files installed along with the MAXIM software and I don't know which dll to use and also tried open each DLL file using call library function node, it does not drop down the function names automatically.

Can anyone help me on this?  

Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast

There is a tool under the Tools menu.  Without opening LabVIEW and looking, I want to say it is Import > Shared Library. That should open a wizard which will generate wrapper vis for you. You'll need a header file.


That might be useful.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at

Hi Sam,

I don't find the Header file for the particular dll file. Because I found this dll file along with application. 

is there any other way to do it?