LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

WSPiApi.h Missing Prototype

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
FARPROC
WINAPI
WspiapiLoad(
    IN  WORD                            wFunction)
/*++

Routine Description
    try to locate the address family independent name resolution routines
    (i.e. getaddrinfo, getnameinfo, freeaddrinfo, gai_strerror).
   
Locks
    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
    InterlockedExchange operation. 

   
Arguments
    wFunction           ordinal # of the function to get the pointer to
                        0   getaddrinfo
                        1   getnameinfo
                        2   freeaddrinfo
   
Return Value
    address of the library/legacy routine

--*/
{
   

/////Function Body

}

 

 

 

An suggestions ????

0 Kudos
Message 1 of 7
(4,091 Views)

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.

 

Luis

0 Kudos
Message 2 of 7
(4,067 Views)

LuisG

 

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.

 

Regards

DWW

0 Kudos
Message 3 of 7
(4,048 Views)

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)

 

Regards

Stuart Betts

0 Kudos
Message 4 of 7
(3,813 Views)

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.

 

NickB

National Instruments

0 Kudos
Message 5 of 7
(3,794 Views)

Nick,

 

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.

 

Cheers

Stuart

0 Kudos
Message 6 of 7
(3,790 Views)

....but of course it will have to because the function is being called directly from Ws32_32.dll and not "through" Wsock32.dll.

 

Thanks again.

Stuart

0 Kudos
Message 7 of 7
(3,776 Views)