2021-06-11 01:51:41 +08:00
|
|
|
const std = @import("std");
|
|
|
|
const expect = std.testing.expect;
|
|
|
|
|
2021-10-24 22:57:00 +08:00
|
|
|
extern fn common_defined_externally() c_int;
|
2021-06-11 01:51:41 +08:00
|
|
|
extern fn incr_i() void;
|
|
|
|
extern fn add_to_i_and_j(x: c_int) c_int;
|
|
|
|
|
2021-10-24 22:57:00 +08:00
|
|
|
test "undef shadows common symbol: issue #9937" {
|
|
|
|
try expect(common_defined_externally() == 0);
|
|
|
|
}
|
|
|
|
|
2021-06-11 01:51:41 +08:00
|
|
|
test "import C common symbols" {
|
|
|
|
incr_i();
|
|
|
|
const res = add_to_i_and_j(2);
|
|
|
|
try expect(res == 5);
|
|
|
|
}
|