We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zig Version: 0.9.0-dev.140+4173a2bc2
0.9.0-dev.140+4173a2bc2
Min Repro: On the above version of Zig, if I try to compile the following code:
const c = @cImport({ @cInclude("windows.h"); @cInclude("sqlext.h"); }); pub fn main() !void { const odbc_2 = c.SQL_OV_ODBC2; }
I get this error:
error: unable to translate C expr: unexpected token .HashHash pub const __MSABI_LONG = @compileError("unable to translate C expr: unexpected token .HashHash"); // C:\Users\mjoer\Code\zig\build-release\lib\zig\libc\include\any-windows-any/_mingw_mac.h:209:13 ^ .\zig-cache\o\255badc43fbb061efcb527c641fb4bea\cimport.zig:82622:26: note: referenced here pub const SQL_OV_ODBC2 = __MSABI_LONG(@as(c_uint, 2)); ^ .\src\main.zig:10:21: note: referenced here const odbc_2 = c.SQL_OV_ODBC2; ^ scratch...The following command exited with error code 1: C:\Users\mjoer\Code\zig\build-release\bin\zig.exe build-exe C:\Users\mjoer\Code\tests\zig\scratch\src\main.zig -lc -lodbc32 --cache-dir C:\Users\mjoer\Code\tests\zig\scratch\zig-cache --global-cache-dir C:\Users\mjoer\AppData\Local\zig --name scratch --enable-cache error: the following build command failed with exit code 1: C:\Users\mjoer\Code\tests\zig\scratch\zig-cache\o\76851c19e00f699686ad20056f38b112\build.exe C:\Users\mjoer\Code\zig\build-release\bin\zig.exe C:\Users\mjoer\Code\tests\zig\scratch C:\Users\mjoer\Code\tests\zig\scratch\zig-cache C:\Users\mjoer\AppData\Local\zig run
The text was updated successfully, but these errors were encountered:
__MSABI_LONG appears to be a macro that uses token pasting (## ). Those macros can't be directly translated to Zig.
__MSABI_LONG
##
As a workaround, you can try the following (untested):
const c = @cImport({ @cDefine("__MSABI_LONG(x)", "(long)(x)"); @cInclude("windows.h"); @cInclude("sqlext.h"); }); pub fn main() !void { const odbc_2 = c.SQL_OV_ODBC2; }
Sorry, something went wrong.
Thanks, that seems to fix the issue.
No branches or pull requests
Zig Version:
0.9.0-dev.140+4173a2bc2
Min Repro: On the above version of Zig, if I try to compile the following code:
I get this error:
The text was updated successfully, but these errors were encountered: