-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for interfacing with C libraries
This adds support for linking against C libraries and using their types and functions. The FFI is fairly strict and a bit limited, such as not performing automatic type conversions, but this is a deliberate choice: it keeps the compiler's complexity at a reasonable level, and it should (hopefully) further drive home the idea that one should avoid interfacing with C as much as they can, as all of Inko's safety guarantees are thrown out of the window when doing so. As part of this work, the precedence of type casts (`x as Type`) is changed to be the same as binary operators. This means expressions such as `x as Foo + y` are now valid, instead of resulting in a syntax error. This makes working with type casts (something you'll need to use more often when working with C code) less painful. This commit also introduces support for conditional compilation at the import level. Based on the build target, a set of build tags is produced. `import` statements support a condition, and when given the `import` is only included if all the tags match. For example: import foo if mac and amd64 This would only import `foo` if the tags "mac" and "amd64" are present. OR and NOT expressions aren't supported, as one can simply use multiple imports. This fixes #290. Changelog: added
- Loading branch information
1 parent
59578a1
commit 6964b32
Showing
74 changed files
with
4,723 additions
and
4,883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.