@dselsam @kha I did not have to create a new shared library. The main limitation of this approach is that the new `extern` functions are only available in compile code. That is, we cannot use them with `#eval`.
26 lines
545 B
Markdown
26 lines
545 B
Markdown
Small project implemented using Lean and C++.
|
|
The C++ file `myfuns.cpp` wraps a C++ object using an `lean_external_object`.
|
|
The file `myfuns.cpp` exposes pure and effectful primitives.
|
|
The file `main.lean` contains a small Lean program that uses the exported primitives.
|
|
|
|
Build instructions
|
|
=====
|
|
|
|
The command
|
|
```
|
|
LEAN_ROOT=<your lean4 directory> make
|
|
```
|
|
creates the executable `out/test`.
|
|
|
|
Example:
|
|
```
|
|
LEAN_ROOT=/Users/leonardodemoura/projects/lean4 make
|
|
```
|
|
|
|
The executable `out/test` should produce the output
|
|
```
|
|
30
|
|
hello
|
|
foobla
|
|
world
|
|
```
|