You must compile the source code for the CIN as a LabVIEW subroutine (.lsb) file. After you compile your C/C++ code in one of the compilers that LabVIEW supports, you use a LabVIEW utility that puts the object code into the .lsb format.
![]() |
Note You must use the cdecl calling convention to compile C code for the CIN. The calling convention defines how data is passed to a function and how clean up occurs after the function call is complete. |
Because the compiling process is often complex, LabVIEW includes utilities that simplify the process. These utilities take a simple specification for a CIN and create object code you can load into LabVIEW. The specific utility you use depends on the platform and compiler you use. Refer to the following sections for more information about compiling on your platform.
![]() |
Note The LabVIEW Base Package can use existing .lsb files but cannot create new .lsb files. You can create .lsb files in the LabVIEW Full and Professional Development Systems. |
To build CINs for LabVIEW on Windows, use the Microsoft Visual C++ or Symantec C compilers.
This section describes using command line tools on Windows to build CINs.
Building CINs using Symantec C is similar to building CINs for Visual C++ Command Line. However, you should use smake instead of nmake on your .lvm file.
LabVIEW includes a template to help you build CINs using the Xcode development environment from Apple Computer, Inc. It is possible to build a CIN with Metrowerks CodeWarrior, but LabVIEW does not provide a template or instructions.
To set up a CIN project on Mac OS, you must first install the CIN template into Xcode.
Install the CIN template into Xcode by copying the LabVIEW Templates folder from the labview\cintools\Xcode Files directory into the \Library\Application Support\Apple\Developer Tools\Project Templates directory.
Complete the following steps to create a new CIN project using Xcode.
The ReadMe (Xcode).rtf file located in the labview\cintools\Xcode Files directory also includes information about how to install the CIN template into Xcode and how to create a new CIN project.
The only supported compiler for Linux is gcc.
Create a makefile using the shell script lvmkmf (LabVIEW Make Makefile), which creates a makefile for a given CIN. Use the standard make command to make the CIN code. In addition to compiling the CIN, the makefile puts the code in a form LabVIEW can use.
The format for the lvmkmf command is shown in the following example code, with optional parameters listed in brackets.
lvmkmf [-o Makefile] LVSBNameLVSBName is the name of the CIN you want to build. If LVSBName is foo, the compiler assumes the source is foo.c and names the output file foo.lsb.
-o is the name of the makefile lvmkmf creates. If you do not specify this argument, the makefile name default is Makefile.
The created makefile will be similar to the following example code.
In the following example code, add the LabVIEW version number, for example lv70, to the end of lv.
#The makefile produced assumes the cin.o, libcin.a, and lvsbutil files are in certain locations. If these assumptions are incorrect, you can edit the makefile to correct the pathnames.
After you compile the source code for the CIN, load the CIN object code.