Proposal: allow setting cflags with @cImport #8676
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
translate-c
C to Zig source translation feature (@cImport)
Milestone
Some clang code-generation options can affect the behavior of
translate-c
by changing the sizes of types. Two notable examples are-fshort-enums
(common in embedded systems) and-fshort-wchar
(for building programs to run under WINE). With #8664 these flags can be passed tozig translate-c
using-cflags
but there is currently no way to pass them when using@cImport
.I propose adding a builtin
@cFlags(flags: []const []const u8) void
. LikecDefine
/cInclude
/etc it would only be valid within acImport
block. This function would appendflags
to the array of flags to be passed to clang for the currentcImport
instance.These flags will also need to be included in the cache manifest since they can change the output translated code.
The text was updated successfully, but these errors were encountered: