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

Allow changing the link name of extern functions without changing the grammar #751

Open
yorickpeterse opened this issue Aug 29, 2024 · 0 comments
Labels
compiler Changes related to the compiler feature New things to add to Inko, such as a new standard library module std Changes related to the standard library

Comments

@yorickpeterse
Copy link
Collaborator

Description

macOS and FreeBSD may include non-standard symbols in function names, such as opendir$INODE64() or fstat@FBSD_1.5 for FreeBSD (see here). Currently we allow dollars in the name so we can handle the former, but we don't handle the case of FreeBSD.

Instead of changing the syntax to allow these special symbols, a better name would be to specify the link name in addition to the call name. A hypothetical syntax would be this:

fn extern opendir as 'opendir$INODE64'(path: Pointer[UInt8]) -> Pointer[UInt8]

Here the as ... bit would specify the name to link the symbol as. The quotes are needed/used so any symbol can be used in the link name. Another option is to flip it around:

fn extern 'opendir$INODE64' as opendir(path: Pointer[UInt8]) -> Pointer[UInt8]

This looks a little less odd, though I'm still not entirely sure about it.

Related work

No response

@yorickpeterse yorickpeterse added feature New things to add to Inko, such as a new standard library module compiler Changes related to the compiler std Changes related to the standard library labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Changes related to the compiler feature New things to add to Inko, such as a new standard library module std Changes related to the standard library
Projects
None yet
Development

No branches or pull requests

1 participant