mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Add function to call bitcode
This commit is contained in:
parent
e89af31015
commit
9276fd8c9d
2 changed files with 27 additions and 34 deletions
|
@ -33,6 +33,8 @@ the `cargo rustc` command above to regenerate it.
|
|||
> $ cargo rustc --release --lib -- --emit=llvm-ir
|
||||
> ```
|
||||
|
||||
**Note**: In order to be able to address the bitcode functions by name, they need to be defined with the `#[no_mangle]` attribute.
|
||||
|
||||
## Importing the bitcode
|
||||
|
||||
The bitcode is a bunch of bytes that aren't particularly human-readable.
|
||||
|
@ -54,3 +56,7 @@ compiler/gen/src/llvm/builtins.bc
|
|||
|
||||
Once that's done, `git status` should show that the `builtins.bc` file
|
||||
has been changed. Commit that change and you're done!
|
||||
|
||||
## Calling bitcode functions
|
||||
|
||||
Use the `call_bitcode_fn` function defined in `llvm/src/build.rs` to call bitcode funcitons.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue