Module Definition Files
- Updated2025-01-22
- 1 minute(s) read
Module Definition Files
When you build a shared library, you configure LabVIEW to use the C calling convention in the .c source file you built with the Call Library Function Node. In contrast, you use the __stdcall calling convention when you call the Win32 API. When you build a shared library with __stdcall, you normally use a module definition .def file to export the functions in your shared library. In the absence of a .def file, __stdcall might truncate function names in an unpredictable pattern, so the actual function name would be unavailable to applications that call the shared library.
You can associate a .def file with a shared library. The .def file contains the statements for defining a shared library, such as the name of the shared library and the functions that it exports, as shown in the following example code:
LIBRARY myshared
EXPORTS
avg_num
The preceding code example demonstrates the following key requirements for .def files:
- The only mandatory entries in the .def files are the LIBRARY statement and the EXPORT statement.
- The LIBRARY statement must be the first statement in the file.
- The name you specify in the LIBRARY statement identifies the library in the import library of the shared library.
- The names you specify in the EXPORTS statement identify the functions that the shared library exports.