I created a C file:
int main() {
return 1;
}
I used Zig's translate-c
command line option to generate a zig file, and I only get some global variable declarations like
pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1;
pub const __FLT16_MAX_EXP__ = 15;
pub const __BIGGEST_ALIGNMENT__ = 16;
pub const __SIZEOF_FLOAT__ = 4;
pub const __INT64_FMTd__ = c"ld";
pub const __STDC_VERSION__ = c_long(201112);
... // and many
And no main
function is found. But if I change the function name to myFunction
like this:
int myFunction(int a) {
return a;
}
A function appears when I re-generate it:
pub export fn myFunction(a: c_int) c_int {
return a;
}
Am I missing something? What's the rule of zig's translate-c
function?