mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Add test for passing extern function to function
This commit is contained in:
parent
375bc2d7b5
commit
52178d14b0
1 changed files with 13 additions and 0 deletions
|
|
@ -56,3 +56,16 @@ test "coerce extern function types" {
|
|||
|
||||
_ = @as(fn () callconv(.c) ?*u32, c_extern_function);
|
||||
}
|
||||
|
||||
fn a_function(func: fn () callconv(.c) void) void {
|
||||
_ = func;
|
||||
}
|
||||
|
||||
test "pass extern function to function" {
|
||||
a_function(struct {
|
||||
extern fn an_extern_function() void;
|
||||
}.an_extern_function);
|
||||
a_function(@extern(*const fn () callconv(.c) void, .{ .name = "an_extern_function" }).*);
|
||||
}
|
||||
|
||||
export fn an_extern_function() void {}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue