LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CreateUDPChannelCOnfig

Hi,everyone,I got a problem with the CreateUDPChannelConfig command in the LABwindows's UDP lib recently.When I tried to compile the code below,there would always be an error that "syntax error; found 'integer constant' expecting ')'",this was very wierd as CreateUDPChannelConfig was defined as:

int CreateUDPChannelConfig (unsigned int localPort, const char *localAddr, unsigned int exclusive, UDPCallbackPtr callback, void *callbackData, unsigned int *channel);

anyone knows where the problem is?thanks a lot!

my original code is:

#include <udpsupp.h>
CreateUDPChannelConfig (35221, UDP_ANY_ADDRESS, 1, 0, 0, 0);that is a simple one just for testing the CreateUDPChannelConfig command.
0 Kudos
Message 1 of 6
(4,599 Views)

What version of LabWindows/CVI are you using. When I compile your same code it compiles just fine without any errors.

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

Message 2 of 6
(4,568 Views)

Unless you are making this call via the Interactive Execution window, you cannot have a function call at file level. That is, you can only call a function from within the body of another function. As your code is written, the call to CreateUDPChannelConfig would be parsed as a function declaration, which would result in the error you describe.

 

Mert A.

National Instruments

Message 3 of 6
(4,566 Views)
thanks ,I am using Labwindows CVI 8.5
Message Edited by ooo on 04-27-2009 02:20 PM
0 Kudos
Message 4 of 6
(4,518 Views)
thanks,but I still haven't figured it out,when I put this command in the body of another callback function,it still got the same error there,could you please give me a simple C code example showing how to implement the operation?thanks A million!
0 Kudos
Message 5 of 6
(4,515 Views)

You can take a look at the UDPReader.prj sample project that is installed. UDPReader.c has a call to CreateUDPChannelConfig in main that should compile properly. If that sample gives you a compile error, then it's possible someone mucked up your udpsupp.h. If it compiles fine, then the problem is in your particular project/code, and you will have to provide more details (i.e. show us your code) in order to figure out why the compiler thinks CreateUDPChannelConfig is a function taking no arguments.

 

Mert A.

National Instruments

0 Kudos
Message 6 of 6
(4,510 Views)