Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
53 ratings:
 4.50 out of 5   

Creating Dynamic Link Library (DLL) in Microsoft Visual C++ 6.0 for use in LabVIEW

Primary Software:
Primary Software Version: 6.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

How do I create a DLL in Microsoft Visual C++ that LabVIEW can reference?

Please follow the following steps to create your own MS Visual C++ DLL Project file using your own code.
  1. Open MS Visual C++ and Select New from the File menu. Choose the Win32 Dynamic-Link Library option and name your project. You can use the defaults for the rest of the wizard's process until it has created your Workspace.
  2. Expand the FileView and add your source code to the Source Files directory.
  3. Add the labview.lib file to the Resource Files directory. This file can be found in <LabVIEW>\cintools (you will have to change the file type to *.lib files).
  4. Go to the Project menu and select the Settings option. Make sure you are looking at the settings for the entire project and not any source files. Switch to the C/C++ tab at the top. You need to change the Category box to Code Generation. You can leave all the first 3 options at their default, but the Struct member alignment needs to be set to 1 Byte. Select OK.
  5. The following files are needed as External Dependencies:
    • extcode.h
    • fundtypes.h
    • platdefines.h
    These files are all located in <LabVIEW>\cintools. All you have to do from your project Workspace is go to Tools»Options»Directories and add the above directory to the list of directories to include in the search path.
  6. Go to the Project menu and select the Settings option. Switch to the Link tab at the top. You need to add a project option into the text box at the bottom called Project Options. Scroll to the end of this listing of compiler directives and enter /NODEFAULTLIB:library and select OK.
  7. You should be able to compile.

Note: If this is the first time you build the project, you might still get a Linking error. If you build the project again (F7), this error should go away. Step 5 above is what fixes this error.

Related Links:
Tutorial: Building a DLL with Visual C++


Report Date: 02/14/2003
Last Updated: 05/12/2016
Document ID: 2UD9OMW0

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