Skip to content

Bundle the native library via the code/<platform>/ extension layout#50

Merged
SethMorrowSoftware merged 1 commit into
mainfrom
claude/beautiful-cray-lwlsgr
Jun 15, 2026
Merged

Bundle the native library via the code/<platform>/ extension layout#50
SethMorrowSoftware merged 1 commit into
mainfrom
claude/beautiful-cray-lwlsgr

Conversation

@SethMorrowSoftware

Copy link
Copy Markdown
Owner

What & why

Ship the native library the intended LCB way: bundled inside the extension under code/<platform>/, which the engine resolves the c:box2dxt> bindings from at load time. One extension carries its own library — no loose .so, no /usr/lib, no sudo, no LD_LIBRARY_PATH, no per-stack loader code, the same on Linux/macOS/Windows. This supersedes the whole preload/Kit-gating line of work (#46#48), which was all working around not knowing about this layout.

Changes

  • tools/package-extension.py (new) — assembles a ready-to-Package folder: box2dxt.lcb + code/<platform>/box2dxt.{so,dll,dylib} pulled from prebuilt/. Open the result in OXT's Extension Builder → Package.lce. Verified it assembles all five platform slots.
  • src/box2dxt-kit.livecodescript — removed the Linux preload auto-call from b2kSetup. The code/ bundle replaces it, and that call leaned on the c:> bindings, which (we now know from the Windows test) resolve against the engine executable's symbols and don't reliably reach libc.
  • examples/* — re-synced embedded Kit.
  • examples/box2dxt-selftest.livecodescript — removed stTestLoaderHelper (it tested the obsolete preload path) and bumped kStHarnessV 19→20.
  • .gitignore — ignore the assembled dist/box2dxt-extension/ artifact.

The b2LoadNativeLib* handlers stay in the .lcb as optional manual fallbacks (uncalled).

The one assumption to confirm in OXT

That OXT honors the code/<platform>/ resource layout, and the folder names. I used the current LiveCode docs' spelling — linux-x86_64, linux-x86, win-x86_64, win-x86, universal-mac — but these have drifted across releases. The packager makes them easy to adjust (CODE_LAYOUT / --mac-folder). Confirm against an existing native OXT extension's layout, or the engine source.

Test

python3 tools/package-extension.py

Open dist/box2dxt-extension/box2dxt.lcb in Extension Builder, Package, install the .lce, then with the .so/.dll nowhere else on the system: open a demo (or put b2Version()4). If it loads from inside the extension, this is the clean cross-platform answer and we can retire the preload machinery entirely.

https://claude.ai/code/session_01EVV5fGeXqtWs8WDrmgWNku


Generated by Claude Code

Pivot to the intended way of shipping native code with an LCB extension: the
per-platform library lives INSIDE the extension under code/<platform>/, and the
engine resolves the c:box2dxt> bindings from there at load time. No loose .so,
no /usr/lib, no sudo, no LD_LIBRARY_PATH, no per-stack loader code -- one
extension carries its library, the same on Linux/macOS/Windows.

- tools/package-extension.py: assembles a ready-to-Package folder (box2dxt.lcb
  + code/<platform>/box2dxt.{so,dll,dylib} from prebuilt/). Open the result in
  Extension Builder and Package -> .lce.
- src/box2dxt-kit.livecodescript: drop the Linux preload auto-call from b2kSetup
  -- the code/ bundle supersedes it, and that call leaned on the c:> bindings
  (which resolve against engine-exe symbols and proved unreliable).
- examples/*: re-synced embedded Kit.
- examples/box2dxt-selftest: remove stTestLoaderHelper (tested the obsolete
  preload path) and bump kStHarnessV 19->20.
- .gitignore: ignore the assembled dist/box2dxt-extension/ artifact.

The b2LoadNativeLib* handlers stay as optional manual fallbacks (uncalled).
Assumes OXT honors the code/<platform>/ layout -- folder names follow current
LiveCode docs and may need tweaking for OXT (see the script header).

https://claude.ai/code/session_01EVV5fGeXqtWs8WDrmgWNku
@SethMorrowSoftware SethMorrowSoftware marked this pull request as ready for review June 15, 2026 23:47
@SethMorrowSoftware SethMorrowSoftware merged commit 7870e6f into main Jun 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants