How can I generate a binding for winuser.h?
I am trying to generate a java binding with winuser.h, I am use this command:jextract -t com.unix C:\SDK\Mingw64\x86_64-w64-mingw32\include\winuser.h -I C:\SDK\Mingw64\x86_64-w64-mingw32\include And then, I got this error:stdlib.h:388:47: error: expected ';' after top level declarator Is there any mistake in my command? How can I fix it?
Hello, The error you're seeing is a parsing error in clang, which usually means there is an issue with the provided headers. Typically you can not include windows API headers directly, and you have to include Windows.h instead. If I look at some of the functions in winuser.h [1], that also seems to be the case for that header. Filtering can be used to extract just the items in winuser.h. For example, in powershell: # find windows SDK header files, and create an array with -I arguments for jextract > $WinSDK = 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0' > $WinIncludes = '-I', "$WinSDK\um", '-I', "$WinSDK\winrt", '-I', "$WinSDK\ucrt", '-I', "$WinSDK\shared" # dump all the includes in Windows.h to 'inc.conf' > jextract --dump-includes inc.conf $WinIncludes"$WinSDK\um\Windows.h" # filter 'inc.conf' for the entries found in 'winuser.h', write the result to 'inc_winuser.conf' > sls -Path inc.conf -Pattern 'winuser.h' | %{$_.Line} > inc_winuser.conf # extract with the filtered includes > jextract --output out --source -t org.jextract $WinIncludes'@inc_winuser.conf' "$WinSDK\um\Windows.h" HTH, Jorn [1] https://learn.microsoft.com/en-us/windows/win32/api/winuser/ On 29/03/2023 14:22, Anivie wrote:
I am trying to generate a java binding with winuser.h, I am use this command:jextract -t com.unix C:\SDK\Mingw64\x86_64-w64-mingw32\include\winuser.h -I C:\SDK\Mingw64\x86_64-w64-mingw32\include And then, I got this error:stdlib.h:388:47: error: expected ';' after top level declarator Is there any mistake in my command? How can I fix it?
participants (2)
-
Anivie
-
Jorn Vernee