lean4-htt/tests/compiler/foreign
Leonardo de Moura 2a1d9a0285 test: simple demo mixing C/C++ and Lean
@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`.
2020-04-06 16:16:49 -07:00
..
main.lean test: simple demo mixing C/C++ and Lean 2020-04-06 16:16:49 -07:00
Makefile test: simple demo mixing C/C++ and Lean 2020-04-06 16:16:49 -07:00
myfuns.cpp test: simple demo mixing C/C++ and Lean 2020-04-06 16:16:49 -07:00
README.md test: simple demo mixing C/C++ and Lean 2020-04-06 16:16:49 -07:00
relative.py test: simple demo mixing C/C++ and Lean 2020-04-06 16:16:49 -07:00

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