Login  Register

Re: CLMemory#getNIOSize should use buffer.limit() instead of buffer.capacity().

Posted by Emily Leiviskä on Nov 16, 2016; 12:33pm
URL: https://forum.jogamp.org/CLMemory-getNIOSize-should-use-buffer-limit-instead-of-buffer-capacity-tp4037407p4037418.html

For any one who finds this by google, I hit the problem below when compiling jogl and fixed it by modifying the mingw system include file (both 32 and 64bit if you need them):

/mingw64/x86_64-w64-mingw32/include/setupapi.h

by adding #include <Devpropdef.h> as required here: https://msdn.microsoft.com/en-us/library/windows/hardware/dn315031(v=vs.85).aspx .

inside the #if/endif where DEVPROPKEY is used

How it looks after changes:

#if _WIN32_WINNT >= 0x0600
#include <Devpropdef.h>
  WINSETUPAPI WINBOOL WINAPI SetupDiGetDevicePropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags);
  WINSETUPAPI WINBOOL WINAPI SetupDiGetDevicePropertyKeys(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DEVPROPKEY *PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags);
#endif

Error message:

c.build.newt.windowlib:
     [echo] Output lib name = newt
     [echo] Compiling newt
       [cc] Starting dependency analysis for 2 files.
       [cc] 2 files are up to date.
       [cc] 0 files to be recompiled from dependency analysis.
       [cc] 1 total files to be compiled.
       [cc] cc1.exe: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
       [cc] In file included from D:\work_java\jogl\src\newt\native\WindowsEDID.c:51:0:
       [cc] D:/opt/msys2/mingw64/x86_64-w64-mingw32/include/SetupApi.h:1879:119: error: unknown type name 'DEVPROPKEY'
       [cc]    WINSETUPAPI WINBOOL WINAPI SetupDiGetDevicePropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags);
       [cc]                                                                                                                        ^~~~~~~~~~
       [cc] D:/opt/msys2/mingw64/x86_64-w64-mingw32/include/SetupApi.h:1879:144: error: unknown type name 'DEVPROPTYPE'
       [cc]    WINSETUPAPI WINBOOL WINAPI SetupDiGetDevicePropertyW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, const DEVPROPKEY *PropertyKey, DEVPROPTYPE *PropertyType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize, DWORD Flags);
       [cc]                                                                                                                                                 ^~~~~~~~~~~
       [cc] D:/opt/msys2/mingw64/x86_64-w64-mingw32/include/SetupApi.h:1880:116: error: unknown type name 'DEVPROPKEY'
       [cc]    WINSETUPAPI WINBOOL WINAPI SetupDiGetDevicePropertyKeys(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DEVPROPKEY *PropertyKeyArray, DWORD PropertyKeyCount, PDWORD RequiredPropertyKeyCount, DWORD Flags);
       [cc]                                                                                                                     ^~~~~~~~~~


$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.