When you use the Call Library Function Node, LabVIEW requests a pointer to the desired function in the library from the operating system. This error indicates that the OS could not provide this pointer, because a function with the name you entered does not exist in the libraryFunction Name in Library Does Not Match Function Call Name
The common reasons for the function name in the library not matching the function name you use to call it include the following:
Function Name Is #defined
#defining (pronounced "pound-defining") is a process in C compilers where you substitute the #defined string for another string, the definition string. You might want to #define when more than one version of the function is available, and the choice depends on certain system properties and is decided at compile time. For example, any Win32 API function that involves strings has two versions, depending on whether the program is designed for Unicode or standard ASCII. You might try to call MessageBox, when MessageBox is #defined as MessageBoxA for ASCII calls.
To determine if this is the problem and to determine the real name of the function in the library, inspect the header (.h) file for the library. Search for the definition of the desired function. Notice in the following example code that under certain circumstances, the MessageBox is defined as MessageBoxA, and under others, it is defined as MessageBoxW. WINUSERAPI int WINAPI MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
WINUSERAPI int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
#define MessageBox MessageBoxW
#define MessageBox MessageBoxA
#endif // !UNICODE
Function Name Is Decorated
Certain compilers (particularly C++ compilers) build DLLs in such a way that the exported function name is not the same as the function name in the source code. This is also known as name decoration. Decoration is the process by which you add other characters to C function names in the resulting object code. The specific format of the decoration depends on the language and the calling conventions. If a function was compiled with calling conventions other than C and no export table was defined for the library, the function name might be decorated.
For example, the same function name that is used in text-based programming languages has with the following names in the library, depending on the calling convention and language:
- Function Name: MyFunction
- C Function, C calling conventions: MyFunction
- C Function, stdcall conventions: _MyFunction@20
- C++ function: ?MyFunction@@YAXHPANPADKPAF@Z
To find the name of an exported function in a library, you might need to inspect the library manually. On Windows NT, you can use the QuickView utility to list the export table for the library. If you have Microsoft Visual C++, it comes with a utility named dumpbin, which you can use with the /exports option to list the export table. Compilers on other operating systems might have similar utilities. The nm utility often works on UNIX systems.