ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Structs to DLL in LabVIEW

I was wondering if anyone out there has used WinSock in LabVIEW. Most of the functions require you to pass in structs suck as Socket, SockAddr and others. While I can open and see the contents of the struct, I am unclear as to how to create them in LabVIEW to call the DLLs. Any ideas will be greatly appretiated.

Thanks

Eugene
0 Kudos
Message 1 of 6
(3,538 Views)
Eugene,

While I haven't used Winsock, I have used DLLs, and am familiar with using structures to some extent.

If you could advise what DLL you are calling, what function, etc, I can probably show you how to setup the dll for use in LabVIEW.

Post it here, or just email me.
0 Kudos
Message 2 of 6
(3,538 Views)
Eugene,

While I haven't used Winsock, I have used DLLs, and am familiar with using structures to some extent.

If you could advise what DLL you are calling, what function, etc, I can probably show you how to setup the dll for use in LabVIEW.

Post it here, or just email me.
0 Kudos
Message 3 of 6
(3,538 Views)
I am using the WinSock dll that comes with windows 2000. I will attach the file here. There are some good descriptions on how to use in on the microsoft website at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/wsapiref_7v1u.asp

The things that I am having problems with the most if trying to figure out what all of the structs that they use to call the function are.

I am ataching the file here as well.

THanks

Eugene
0 Kudos
Message 4 of 6
(3,538 Views)
i am doing such things ,and when i include winsock2.h,cvi hints that redeclaration in winsock2.h.later i use vc++6.0 to create a dll,int the functions i can use "Socket, SockAddr and others" because i include "winsock2.h",but in cvi i do not use them.Now cvi can call the functions in the lib generated from the dll using the "Options\Generate Dll Import Library",but the value returned alwsays is 10038(in vc++ Error Codes ,you can find it refer to "WSAENOTSOCk").who can help me with the question?
0 Kudos
Message 5 of 6
(3,538 Views)
You may have to look up Windows Platform SDK where all the structures are defined and explained. Such as:
struct sockaddr {
u_short sa_family;
char sa_data[14];
};
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
typedef struct _SOCKET_ADDRESS {
LPSOCKADDR lpSockaddr ;
INT iSockaddrLength ;
} SOCKET_ADDRESS, *PSOCKET_ADDRESS, FAR * LPSOCKET_ADDRESS ;
and many other structures. Are they what you wanted?
0 Kudos
Message 6 of 6
(3,538 Views)