LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Link err with GetLIBErrorString in CVI Inet toolkit & CVI70

I am using the CVI Internet toolkit with CVI70 for sending e-mail. I process errors using the function:
char* GetLIBErrorString(int error);
I do have the fp included in my project, so the instrument is loaded. Also, I did try using the documented function:
void INET_GetErrorMessage (int Error_Code, char **Error_Message);
however, this function is not declared in cviinet.h, thus resulting in a compile error (though it is listed as a node in the cviinet.fp file).
Am I doing something wrong or is there an update to the CVI Internet toolkit that I should be aware of?

The CVI Internet Toolkit version I have is v. 1.0,1
0 Kudos
Message 1 of 4
(2,984 Views)
Hello

I didn't get the link error with GetLIBErrorString, the import library does have an entry ( I used dumpbin to check this out) for this function. Seems to work fine. Make sure the fp file is linked to the correct import libray. You can check this by going to Instruement >> Edit. Select the CVI Internet Toolkit and click on "Show Info". It should be linked to the cviinet.lib

INET_GetErrorMessage is defined in the cviinet.dll, and you can load it dynamically in your code to call that function as follows

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=IN
ET_GetErrorMessage (Error_Code);
FreeLibrary(DLLHandle); //free the dll handle

I hope this helps.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 4
(2,984 Views)
You can also link INET_GetErrorMessage into the INET function panel in a more permanent manner:

1. Add the prototype for INET_GetErrorMessage to the cviinet.h file, I used:
void INET_GetErrorMessage (int errorCode, char **errorMessage);

2. Open the cviinet.fp file and select Instrument->Edit and then select Detach Program

3. 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).

4. Open the cviinet.fp file and select Instrument->Edit and then select Reattach Program

That should permanently link the function into the instrument so you don't have to load it dyna
mically.

Regards,
Ryan K.
NI

Note: The cviinet.h and cviinet.dll are in the cviinet directory within your CVI directory, probably something like C:\Program Files\National Instruments\CVI70\cviinet
0 Kudos
Message 3 of 4
(2,984 Views)
Oops, after trying out my solution a couple of times I found a problem. The prototype specified in the function panel isn't the right prototype. Use the prototype Bilal gave you:
char *INET_GetErrorMessage(int ErrorCode);
rather than the one in my last post. Note that the call generated by the function panel won't be of the right form unless you fix the function panel as well.

Regards,
Ryan K.
0 Kudos
Message 4 of 4
(2,984 Views)