-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
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
non callconv(.C)
function pointers no longer allowed in extern contexts
#19921
Comments
But without a callconv for extern fn you run into #19841. What is the use case for unspecified callconv for extern fns? |
its not an unspecified callconv for extern fns, its a pointer to an unspecified callconv fn being passed to a |
On the line For, const T = extern struct {
f: *const fn () void,
}; The function pointer needs a callconv or else how would zig know what to do when you write: const t: T = ...
t.f(); If |
the comptime {
@compileLog(@typeInfo(@TypeOf(exported)).Fn.calling_convention);
@compileLog(@typeInfo(@TypeOf(not_exported)).Fn.calling_convention);
}
export fn exported() void {}
fn not_exported() void {}
no callconv means zigs callconv (or other depending on context, zig knows because zig sees and is in control of the code), the point is to be callable on the zig side but opaque on the C side |
AFAIK there is no such thing as a zig callconv for extern fn. If there were we could have extern fns with ErrorUnions |
thats exactly what im saying, there isnt |
Zig Version
0.12
Steps to Reproduce and Observed Behavior
this worked in 0.11, caused by #17509 see #17468 (comment)
Expected Behavior
no error
The text was updated successfully, but these errors were encountered: