|| 4.57 out of 5
Creating Dynamic Link Library (DLL) in Microsoft Visual C++ 6.0 for use in LabVIEW
Primary Software Version:
Primary Software Fixed Version:
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.
- 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.
- Expand the FileView and add your source code to the Source Files directory.
- 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).
- 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.
- The following files are needed as External Dependencies:
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.
- 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.
- 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++