Zulip Chat Archive

Stream: new members

Topic: does leans ffi only work on Linux?


Srayan Jana (Aug 25 2025 at 06:40):

Looking at the official example, it seems to only work with shared .o files and not .dll
https://github.com/leanprover/lean4/blob/master/src/lake/examples/ffi/lib/lakefile.lean
I haven’t tested to see if it would work statically linked but it’s a shame dynamic linking seems to not be a thing

Sebastian Ullrich (Aug 25 2025 at 07:44):

It should work as expected on all supported platforms, it is run by our CI on all of them. .o object files are what comes before static/shared archives.

Srayan Jana (Aug 25 2025 at 08:17):

Gotcha, I’ll try it out again

Chase Norman (Aug 31 2025 at 17:32):

Canonical has dynamic linking working on Mac, Windows, and Linux.

Julian Berman (Sep 01 2025 at 13:43):

I got it working fairly painlessly as well for rpylean, though I probably never tested on Windows. https://github.com/Julian/rpylean/blob/main/rpylean/leanffi.py

Eric Taucher (Sep 01 2025 at 18:27):

(deleted)

Srayan Jana (Sep 01 2025 at 18:32):

I should mention that I eventually got the FFI working on both Linux and Windows, but there has been a lot of complications
https://github.com/ValorZard/LeanDoomed/tree/main
Right now, I can build it from source, but I can't create a distributable executable

Really the worst part has been interfacing with the C Compiler and trying to figure out the right combinations of build flags to get LLVM and GCC to work properly

Eric Taucher (Sep 01 2025 at 18:38):

(deleted)

Eric Taucher (Sep 01 2025 at 18:43):

(deleted)

Eric Taucher (Sep 01 2025 at 18:55):

(deleted)

Srayan Jana (Sep 01 2025 at 20:57):

@Eric Taucher if you want, I'd love if you could get the repo I linked to run on your computer. It SHOULD, but idk. I wrote instructions in the README to help you out


Last updated: Dec 20 2025 at 21:32 UTC