Skip to content

fix: correct LEAN_EXPORT attribute order in ffi.cpp - #14888

Merged
Kha merged 1 commit into
leanprover:masterfrom
joehendrix:ffi
Aug 25, 2026
Merged

Kha merged 1 commit into
leanprover:masterfrom
joehendrix:ffi

Conversation

@joehendrix

@joehendrix joehendrix commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

This PR fixes attribute/extern "C" ordering affecting builds with some versions of gcc.

Specifically, gcc ignores LEAN_EXPORT visibility attribute placed before extern "C", so these getters were not exported from libleanshared.

This change was drafted with AI assistance. I confirmed that reordering to extern "C" LEAN_EXPORT fixes on GCC 11, 13 and 15.

GCC ignores a visibility attribute placed before `extern "C"`, so these FFI
getters were not exported from libleanshared under GCC.

We confirmed that reordering to `extern "C" LEAN_EXPORT` fixes on GCC 11,
13 and 15.
@joehendrix
joehendrix marked this pull request as draft August 21, 2026 17:41
@joehendrix
joehendrix marked this pull request as ready for review August 21, 2026 17:43
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Aug 21, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase f6c7d68c7fc27e3b60585f30740c7d141d3c5b36 --onto 16e77c407779fde9a649adf3478204d1915371a3. You can force Mathlib CI using the force-mathlib-ci label. (2026-08-21 18:04:53)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase f6c7d68c7fc27e3b60585f30740c7d141d3c5b36 --onto 16e77c407779fde9a649adf3478204d1915371a3. You can force reference manual CI using the force-manual-ci label. (2026-08-21 18:04:55)

@Kha Kha added the changelog-compiler Compiler, runtime, and FFI label Aug 25, 2026
@Kha
Kha enabled auto-merge August 25, 2026 12:41
@Kha

Kha commented Aug 25, 2026

Copy link
Copy Markdown
Member

Thanks!

@Kha
Kha added this pull request to the merge queue Aug 25, 2026
Merged via the queue into leanprover:master with commit 6f48b8a Aug 25, 2026
34 of 37 checks passed
@nomeata nomeata mentioned this pull request Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-compiler Compiler, runtime, and FFI toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants