Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 5 out of 5     Rate this Document

The GetErrorMessage Function From the CVI Internet Toolkit Causes a "Missing Prototype" Error

Primary Software: LabWindows/CVI Add-ons>>Enterprise Connectivity Toolset
Primary Software Version: 1.1
Primary Software Fixed Version: N/A
Secondary Software: LabWindows/CVI Development Systems>>Base Package

Problem: I am trying to call the GetErrorMessage function from the CVI Internet Toolkit instrument but I get a compile error "Missing Prototype".

Solution: This function is implemented in the instrument DLL but is not in the header or the import library. It has a function panel in the cviinet.fp file, although the function panel is slightly incorrect. There are a couple of options for using it:

Option 1 (reccomended): Fix the header file and import library.
  1. Open cviinet.h and replace the line
    char *GetLIBErrorString(int error); (near the bottom)
    with the line
    char* INET_GetErrorMessage (int ErrorCode);
  2. Generate a new .lib file for the instrument by opening cviinet.h and selecting Options->Generate DLL Import Library and then browsing to the cviinet.dll (should be in your system32 directory, do a file search if you have trouble finding it).
  3. Fix the function panel (optional):
    • Open the cviinet.fp file.
    • Browse to the GetErrorMessage function (at the very bottom) and double click on it to edit it.
    • Right click on the Error Message control and select Change Control Type.
    • Select Return Value from the list that appears and click OK.
    • Click OK on the Edit Return Value Control window which appears.
    • Select File->Save FP File and close the function editor
  4. Open the cviinet.fp file and select Instrument->Edit and then select Reattach Program
Note: The cviinet.h and cviinet.dll are in the cviinet directory within your CVI directory, most likely C:\Program Files\National Instruments\CVI70\cviinet"

Option 2: Load the DLL programatically and call the function dynamically.
The following code loads the DLL and calls the GetErrorMessage function without using an import library or header file:

static HINSTANCE DLLHandle;
static char* (CVIFUNC *INET_GetErrorMessage)(int Error_Code); //function prototype
DLLHandle = LoadLibrary("cviinet.dll");
INET_GetErrorMessage = (void*) GetProcAddress(DLLHandle,"INET_GetErrorMessage");
Error_Message=INET_GetErrorMessage (Error_Code);
FreeLibrary(DLLHandle); //free the dll handle

Note: You will have to include windows.h and have the CVI Windows SDK libraries installed in order to use this option.

Related Links: KnowledgeBase 21SE44PR: How Do I Use the Windows SDK in CVI?

Attachments:





Report Date: 05/13/2004
Last Updated: 12/07/2004
Document ID: 39CBIN1P

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