manual c function interop
This commit is contained in:
@@ -8,6 +8,25 @@ odin build . -out:brolang
|
||||
/tmp/prototype
|
||||
```
|
||||
|
||||
Bodyless `c func` declarations bind exact external symbols and require concrete
|
||||
types:
|
||||
|
||||
```bro
|
||||
foreign_add :: c func(a, b i32) i32
|
||||
```
|
||||
|
||||
Additional native inputs and libraries are passed to the final `zig cc`
|
||||
invocation in command-line order:
|
||||
|
||||
```sh
|
||||
./brolang examples/interop/manual -o /tmp/manual \
|
||||
--link examples/interop/manual/native.c
|
||||
```
|
||||
|
||||
`--link` accepts C sources, object files, and direct library paths.
|
||||
`--library-path <dir>` becomes `-L<dir>`, and `--library <name>` becomes
|
||||
`-l<name>`.
|
||||
|
||||
Compilation phases are isolated under `compiler/`:
|
||||
|
||||
```text
|
||||
@@ -41,6 +60,8 @@ Current prototype features:
|
||||
- Directory packages with merged declarations and file-local relative imports
|
||||
- Qualified imported globals and functions with package-aware symbol mangling
|
||||
- Demand-monomorphized Brolang and C-ABI functions
|
||||
- Bodyless concrete C function declarations with exact external symbol names
|
||||
- Ordered linking of additional C sources, objects, and libraries
|
||||
- Checked signed addition
|
||||
- Static, eager runtime, and deferred problematic globals
|
||||
- Runtime diagnostics followed by `llvm.trap`
|
||||
|
||||
Reference in New Issue
Block a user