07-24-2018 02:37 AM
Hi,
I'm developping on an eval version LabWindonws/CVI 2017. I willing to activate the software, but I don't know which version to chose (Base package or Full Development System).
I saw here that not all windows SDK library are avaible depending on the version choosed.
I know that in the future I'll need to use websocket, and Windows SDK propose a specific library for this matter.
Does it means that eval version and base version can't support this lib ? Because I can find it there (C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64) and the header file is already added in NI installation files (C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1)
But when I add the header and library file to the project it doesn't work. The error I get is unknown type name 'WEB_SOCKET_HANDLE'. Although it's declared on line 34 of the header file
Will it work with Full Development System ?
Solved! Go to Solution.
07-24-2018 03:48 AM
Hi,
Some Win32 libraries are indeed available only for Full Development System license. The eval version has the same capabilities as FDS. The libs and headers are installed by all versions but in Base version if a lib is not supported you get a link error like the following:
Link Command-line Application.exe 'shell32.lib' is available only in the Full Development System. Build failed.
However, compilation should work.
For websocket I think you need Windows 8 or newer, because in websocket.h on line 32 I see the following condition:
#if NTDDI_VERSION >= NTDDI_WIN8
Also don't forget to add websocket.lib to the project
07-24-2018 05:03 AM
Thanks for your response.
I am surprised that eval version equals FDS version in possibility. Because when I only add the lib file to my project and the header file to my maic .c file it doees not compile.
Build Status (User Interface Application.prj - Debug) User Interface Application.c - 20 errors 15, 1 In file included from e:\Programmation\Chereau\Doc\TestWebSocket\User Interface Application.c:15: "websocket.h"(34,16) error: a parameter list without types is only allowed in a function definition "websocket.h"(95,5) error: unknown type name 'PVOID' "websocket.h"(96,5) error: unknown type name 'ULONG' "websocket.h"(101,5) error: unknown type name 'PCHAR' "websocket.h"(102,5) error: unknown type name 'ULONG' "websocket.h"(103,5) error: unknown type name 'PCHAR' "websocket.h"(104,5) error: unknown type name 'ULONG' "websocket.h"(111,9) error: type name requires a specifier or qualifier "websocket.h"(111,28) error: a parameter list without types is only allowed in a function definition "websocket.h"(111,43) error: expected ';' at end of declaration list "websocket.h"(112,9) error: unknown type name 'ULONG' "websocket.h"(117,9) error: type name requires a specifier or qualifier "websocket.h"(117,28) error: a parameter list without types is only allowed in a function definition "websocket.h"(117,43) error: expected ';' at end of declaration list "websocket.h"(118,9) error: type name requires a specifier or qualifier "websocket.h"(118,23) error: expected parameter declarator "websocket.h"(118,23) error: expected ')' "websocket.h"(118,22) note: to match this '(' "websocket.h"(118,61) error: expected ';' at end of declaration list "websocket.h"(119,9) error: unknown type name 'USHORT' "websocket.h"(123,1) error: unknown type name 'HRESULT' Build failed.
Given the fact that almost all the error comes from unknown types define in Windows, I add an include for windows.h.
Then the project compile but I can't declare any variable using types defined in the websocket header.
Build Status (User Interface Application.prj - Debug)
User Interface Application.c - 4 errors
24, 1 error: unknown type name 'PWEB_SOCKET_PROPERTY'
25, 1 error: unknown type name 'WEB_SOCKET_HANDLE'
28, 1 error: unknown type name 'PWEB_SOCKET_HTTP_HEADER'
29, 1 error: unknown type name 'PWEB_SOCKET_HTTP_HEADER'
Build failed.
Does anyone manage to make it work ?
07-24-2018 06:40 AM
Try defining NTDDI_VERSION to NTDDI_WIN8
Options>>Build Options>>Compiler Defines - add /DNTDDI_VERSION=NTDDI_WIN8
07-24-2018 08:17 AM - edited 07-24-2018 08:18 AM
Thanks again Constantin.
Now I can use the types defined in the header file. And my project builds. But at run time, the .exe can't find the librairy functions
Here is my code :
//============================================================================== // Include files #include <windows.h> #include <websocket.h> #include <ansi_c.h> #include <cvirte.h> #include <userint.h> #include "User Interface Application.h" #include "toolbox.h" //============================================================================== // Constants #define PROPERTY_COUNT 2 WEB_SOCKET_PROPERTY property[PROPERTY_COUNT]; WEB_SOCKET_HANDLE handle; PCSTR subprotocols; PCSTR extensions; PWEB_SOCKET_HTTP_HEADER initialHeaders; PWEB_SOCKET_HTTP_HEADER additionalHeaders; HRESULT result; unsigned char buf [32768]; //============================================================================== // Types //============================================================================== // Static global variables static int panelHandle = 0; //============================================================================== // Static functions //============================================================================== // Global variables //============================================================================== // Global functions /// HIFN The main entry-point function. int main (int argc, char *argv[]) { int error = 0; /* initialize and load resources */ nullChk (InitCVIRTE (0, argv, 0)); errChk (panelHandle = LoadPanel (0, "User Interface Application.uir", PANEL)); /* display the panel and run the user interface */ errChk (DisplayPanel (panelHandle)); errChk (RunUserInterface ()); Error: /* clean up */ if (panelHandle > 0) DiscardPanel (panelHandle); return 0; } //============================================================================== // UI callback function prototypes /// HIFN Exit when the user dismisses the panel. int CVICALLBACK panelCB (int panel, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_GOT_FOCUS: break; case EVENT_LOST_FOCUS: break; case EVENT_CLOSE: QuitUserInterface (0); break; } return 0; } int CVICALLBACK OpenCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: property[0].pvValue = buf; property[0].Type = WEB_SOCKET_ALLOCATED_BUFFER_PROPERTY_TYPE; property[0].ulValueSize = 32768; property[1].pvValue = 0; property[1].Type = WEB_SOCKET_DISABLE_UTF8_VERIFICATION_PROPERTY_TYPE; property[1].ulValueSize = sizeof(BOOL); result = WebSocketCreateClientHandle(property, PROPERTY_COUNT, &handle); break; case EVENT_RIGHT_CLICK: break; } return 0; }
I'm not completely sure that the lib is correctly added though (Edit >> Add Files to project).
I also add my project to the post if someone can check if I included the library well.
07-24-2018 08:37 AM
Why don't you try to add the lib from its original location(c:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86\websocket.lib). If you switch configuration to 64-bit CVI will pick for you the proper version.
07-24-2018 09:19 AM
Thank you very much,
The project now compile and seems to work at run time. I still have to find out how to make the library work.
For those who might see this post later with the same issues I had, the microsoft doc can be found here :
I'm currently struggling to create a WebSocketClientHandler. The function call creating a FATAL RUN-TIME ERROR caused by a General Protection Fault.
If I find a way to make it work, I'll post a tutorial ^^