mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-22 21:07:43 +00:00
39 lines
853 B
Markdown
39 lines
853 B
Markdown
# loro-ffi
|
|
|
|
- `cargo build --release`
|
|
- move `libloro.a` and `loro_ffi.h` to directory `examples/lib`
|
|
- run
|
|
|
|
## C++
|
|
|
|
Read more: [cbindgen](https://github.com/eqrion/cbindgen)
|
|
|
|
```bash
|
|
g++ loro.cpp -Bstatic -framework Security -L. -lloro -o loro
|
|
```
|
|
|
|
## Go
|
|
|
|
Read more: [cgo](https://pkg.go.dev/cmd/cgo)
|
|
|
|
```bash
|
|
go run main.go
|
|
```
|
|
|
|
## [Python](../loro-python/)
|
|
|
|
## Java
|
|
|
|
Candidates:
|
|
|
|
- [Panama](https://jdk.java.net/panama/) [blog](https://jornvernee.github.io/java/panama/rust/panama-ffi/2021/09/03/rust-panama-helloworld.html)
|
|
- [JNI](https://github.com/jni-rs/jni-rs)
|
|
- [JNR](https://github.com/jnr/jnr-ffi)
|
|
|
|
### Panama
|
|
|
|
install panama-jdk and jextract
|
|
|
|
```bash
|
|
jextract -I /Library/Developer/CommandLineTools/usr/include/c++/v1 -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -d loro_java -t org.loro -l loro -- lib/loro_ffi.h
|
|
```
|