04-06-2011 01:23 PM
Hi, I am doing some exercises on programming datasocket... (communications between 2 applications....)
I am getting these errors:
Undefined symbol '_DS_GetLibraryErrorString@12' referenced in "PROJECT3SEND.C".
Undefined symbol '_DS_GetLastMessage@12' referenced in "PROJECT3SEND.C".
Undefined symbol '_DS_SetDataValue@20' referenced in "PROJECT3SEND.C".
.
.
.
.
I have some routines like this:
//error checking for datasocket functions
int Checkerror(int error )
{
if (error <0) //if problem, display the error message
{
DS_GetLibraryErrorString (error, errorBuf, 256);
SetCtrlVal(WritepanelHandle, WRT_STATUS ,errorBuf);
return -1;
}
return 0;
}
Any help?
04-06-2011 01:28 PM
Hi,
did you add dataskt.fp to your project?
04-06-2011 01:31 PM
Yes, dataskt.h is included.
04-06-2011 01:37 PM
If I am not mistaken including the .h file is not sufficient, you also should add the .fp file to your project: Edit / Add Files to Project
04-06-2011 01:48 PM
It seems that I don'thave this file in the folder. Any idea where to get it from?
04-06-2011 02:18 PM
It is supposed to be in the folder toolslib/datasock...
04-06-2011 02:35 PM
Sorry but I have a real problem here that I am trying to solve. I have a separate C program. How do I initiliase my labwindows interface server with a function like this. Note that this function is in a separate C program (it is supposed to be running separately from labwindows interface). What am I supposed to do in my labwindows interface for this to work.
Note that my labwindows interface is called PuServer.
int PuServerInit()
{
UINT16 port = DEFAULT_DB_PORT;
char PU_ServerInet[20];
char ipstr[24];
nvramGetIpStr(ipstr);
/* already socked */
if (PU_SockFd != 0) return 0;
if (strncmp(ipstr,"10.102.",7) == 0)
strcpy(PU_ServerInet,"10.102.1.1\0");
else
strcpy(PU_ServerInet,"192.168.2.77\0");
/* create socket */
if ((PU_SockFd = socket (PF_INET,SOCK_STREAM,0)) == DB_ERROR)
{
printf ("failed PuServerInit\n");
PU_SockFd=0;
return DB_ERROR;
}
/* connect to server */
PU_SockAddr.sin_family = AF_INET;
PU_SockAddr.sin_port = htons(port);
PU_SockAddr.sin_addr.s_addr = inet_addr(PU_ServerInet);
bzero (PU_SockAddr.sin_zero, sizeof(PU_SockAddr.sin_zero));
if (connect (PU_SockFd,
(struct sockaddr *) &PU_SockAddr,
SOCK_ADDR_SIZE)==DB_ERROR)
{
printf ("failed PuServerInit-Connect\n");
PU_SockFd=0;
return DB_ERROR;
}
PU_Peer = 1;
return 0;
}
04-07-2011 04:12 PM
I am not sure what version you are using but if it is before CVI 5.5 you can look here for some examples of using sockets.
If you are using CVI later than that there are libraries built in to use sockets, and examples that ship with CVI. If you search the library in CVI for Socket you will find both TCP and UDO sockets, and you can then pull up the functions panel and find the help files and examples for using them.
05-19-2021 02:16 AM
Hi Wolfgang,
I try to compile a project that include the recvfrom function, but it always give me a Undefined symbol '__imp_recvform error. Could you help to tell me which function panel .fp should be added into the project?
05-19-2021 02:46 AM
Hi Jason,
you should start a new thread for a new question...
This said, the function is part of the win32 api, https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom. So there is no NI function panel, you have to include windows.h, which provides access to the Windows SDK functions.