Skip to content
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

make translate-c translate "main" into something that start code will recognize properly #4029

Closed
daurnimator opened this issue Jan 2, 2020 · 1 comment
Milestone

Comments

@daurnimator
Copy link
Contributor

daurnimator commented Jan 2, 2020

Originally found by @daurnimator in #988 (comment)

When zig translate-c is run on a file that has an entrypoint (such as main), the signature does not match the one expected by zig's start code.

/home/daurnimator/src/zig/lib/std/start.zig:258:17: error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'
                @compileError(bad_main_ret);
                ^

Should we add support for the traditional C entry point signatures?

@daurnimator daurnimator added standard library This issue involves writing Zig code for the standard library. translate-c C to Zig source translation feature (@cImport) labels Jan 2, 2020
@andrewrk andrewrk added the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Jan 2, 2020
@andrewrk andrewrk changed the title translate-c and entry points make translate-c translate "main" into something that start code will recognize properly Jan 2, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Jan 2, 2020
@andrewrk andrewrk removed proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. standard library This issue involves writing Zig code for the standard library. translate-c C to Zig source translation feature (@cImport) labels Jan 4, 2020
@andrewrk
Copy link
Member

andrewrk commented Jan 4, 2020

This is actually already working fine - just need to pass -lc for the build-exe command.

@andrewrk andrewrk closed this as completed Jan 4, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants