Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
2 rating:
 1.5 out of 5     Rate this Document

Differences Between Calling a DLL Statically Versus Dynamically

Primary Software: LabWindows/CVI Development Systems>>Base Package
Primary Software Version: 9.0
Primary Software Fixed Version: N/A
Secondary Software: LabWindows/CVI Add-ons>>Real-Time Module

Problem:
I want to use a Dynamically Linked Library (DLL) in my LabWindows/CVI program. Should I call the DLL statically or dynamically? What is the difference between the two?

Solution:
A function in a DLL can be called statically or dynamically.

Table 1: Comparison Between Static and Dynamic Calls

Attribute Static Dynamic
Required to Use Import Library (.llb)
Header File (.h)
.dll
.dll
How Functions are Called Functions are called by name A handle to the function must first be established; the handle is used to call the function
Memory The entire DLL is loaded into memory when the caller is loaded The function is loaded into memory when it is called
When to Use
  • Ease of use is important
  • Program memory is not limited
  • Execution speed is important
  • Many of the functions in the DLL are used
  • Program memory is limited
  • A subset of the functions of the DLL are used


Related Links:
KnowledgeBase 47SG4UXL: How Can I Add Folders Of Startup DLLs for Real-Time Systems?
KnowledgeBase 3W9DPTG2: Link Error When Calling a DLL in LabWindows/CVI
LabVIEW 8.6 Help: Calling External APIs

Attachments:





Report Date: 02/13/2009
Last Updated: 02/17/2009
Document ID: 4UCH9KYP

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit