Skip to content

@ccallable: emit a header file #1797

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

Closed
Tracked by #1802
certik opened this issue May 12, 2023 · 1 comment · Fixed by #1861
Closed
Tracked by #1802

@ccallable: emit a header file #1797

certik opened this issue May 12, 2023 · 1 comment · Fixed by #1861
Assignees

Comments

@certik
Copy link
Contributor

certik commented May 12, 2023

This feature is the opposite of #1613. When creating some function that is exposed to C, such as:

@ccallable(header="some_header.h")
def f(x: i32) -> f64:
    "Some documentation."
    return x + 1

it will not only create the function f that is callable from C, but it would also emit / create a C header file some_header.h that would contain the C signature, together with the docstring as documentation (using C comments).

We want to be able to specify different @ccallable in separate files and they would all contribute to the same C headerfile. Probably one could configure this using a command line argument, but one solution is to create the header file if it does not exist, and then keep appending to it (specifically, inserting into it, since there are typically the ifdef macros at the beginning and end). Another solution is to compile all the separate files into one ASR, and then create the headerfile at once.

We can also only emit the header file if requested at the command line.

@certik certik mentioned this issue May 13, 2023
25 tasks
@Smit-create Smit-create self-assigned this May 26, 2023
@Smit-create
Copy link
Collaborator

I am working on this.

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

Successfully merging a pull request may close this issue.

2 participants