I have some software which uses the wpcap v4.1.1 (Ethernet packet capture) open source library. I have successfully managed to build and run this software (after a few tweaks to some of the pcap header files) with CVI version 8.5.1. I have recently been constrained to using CVI 2009 and the same software won't build. The following error is displayed
WSPiApi.h (line number) Missing Prototype (Require function prototypes build option is enabled)
Some basic digging gives this file as part of the windows SDK. Alas CVI version 8.5.1 SDK doesn't have this file and I assume it is some other part of the CVI 2009 SDK that is trying to pull it in
The function causing the problem is this
static // CHANGED BY CVI
IN WORD wFunction)
try to locate the address family independent name resolution routines
(i.e. getaddrinfo, getnameinfo, freeaddrinfo, gai_strerror).
this function call is not synchronized. hence the library containing
the routines might be loaded multiple times. another option is to
synchronize through a spin lock using a static local variable and the
wFunction ordinal # of the function to get the pointer to
address of the library/legacy routine
An suggestions ????
Yes, this is a problem that needs to be fixed in the SDK headers that ship with CVI. Fortunately, you can easily make this change yourself, in your copy of CVI 2009.
You'll need to make the following change in C:\Program Files\National Instruments\CVI 2009\sdk\include\WinDef.h:
Line 228: typedef int (FAR WINAPI *FARPROC)(void);
This should fix the problem. Let me know if you run into other problems.
That worked thankyou,
The only additional thing I had to do was add WSock32.lib to the project as it didn't want to link otherwise.
On a similar note to the original poster (from same company and using the same code!), I am using CVI 2010 and get the following linker error. Any ideas?
Undefined symbol '_WSAloctl@36' referenced in "EPFV_Driver.c" (Where EPFV_Driver.c is our local 'driver' software)
Hey Stuart -
To use WSAIoctl, it looks like you just need to add Ws2_32.lib to your project. Here's a list of the win32 API import libraries that CVI loads automatically. In general, if the lib you need (in this case, Ws2_32.lib) is not in this list, you need to manually add it to your project.
Thanks for the reply. That seems to work!
I had looked at the Wsock32.dll in Dependency Walker and it shows Ws32_32.dll included as part of it, so assumed I wouldn't have to include it again as part of my project.
....but of course it will have to because the function is being called directly from Ws32_32.dll and not "through" Wsock32.dll.