11-15-2013 02:16 AM
Hallo,
I'm quite new to LabView/LabWindows/CVI. I'm trying to create a very simple C++ application that will exchange Network Shared Variables with a LabView VI.
But no matter which function I call, I always get the error "Argument is invalid". For example when creating a browser to browse for available variables:
int _tmain(int argc, _TCHAR* argv[])
{
CNVBrowser* browser = NULL;
int retVal = CNVCreateBrowser(browser);
if(retVal != 0)
{
const char* error = CNVGetErrorDescription(retVal);
std:: cout << error;
}//end if
if(browser != NULL) CNVDisposeBrowser(*browser);
return 0;
}
This gives me a return value of -6393 which means "Argument is invalid".
I suppose there is something very basic I'm doing wrong. Can anyone help me out?
Thanks!
11-15-2013 03:08 AM
I should say that you need to use the function this way:
CNVBrowser browser; int error; error = CNVCreateBrowser (&browser);
The function should correctly return the handle that it creates. While executing your code inside CVI environment you are likely to get a "Null pointer passed to library function" error.
11-15-2013 03:08 AM
BorisBrock:
You are getting confused over what should be a pointer. The code ought to read something like:
int _tmain(int argc, _TCHAR* argv[])
{
CNVBrowser browser = NULL;
int retVal = CNVCreateBrowser(&browser);
if(retVal != 0)
{
const char* error = CNVGetErrorDescription(retVal);
std:: cout << error;
}
if (browser)
CNVDisposeBrowser(browser);
return 0;
}
HTH!
11-15-2013 03:11 AM
Thank's so much!
All those years of C# development must have clouded my pointer-mind 😉