How to run:
$ crystal run src/bar.cr
hello from crystal
Just called a Rust function from C!
| name: bar | |
| version: 0.1.0 | |
| authors: | |
| - davidkellis <[email protected]> | |
| targets: | |
| bar: | |
| main: src/bar.cr | |
| crystal: 0.26.1 | |
| license: MIT |
| # TODO: Write documentation for `Bar` | |
| module Bar | |
| VERSION = "0.1.0" | |
| end | |
| @[Link(ldflags: "#{__DIR__}/../../foo/target/debug/libfoo.dylib")] | |
| lib Foo | |
| fun call_from_c() | |
| end | |
| def main | |
| puts "hello from crystal" | |
| Foo.call_from_c | |
| end | |
| main |