Skip to content

Define DMOD_CURRENT_ALLOCATOR when building in DMOD_SYSTEM mode - #18

Merged
JohnAmadis merged 1 commit into
masterfrom
claude/epic-hopper-jck8tq
Sep 19, 2026
Merged

JohnAmadis merged 1 commit into
masterfrom
claude/epic-hopper-jck8tq

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

Summary

Companion PR to choco-technologies/dmod#307, which requires DMOD_CURRENT_ALLOCATOR to be defined on the system side too (it used to default to NULL/anonymous there).

dmfsi.h's inline helpers (dmfsi_strndup, dmfsi_path_create, dmfsi_path_free) and examples/ramfs/ramfs.c already call the unified Dmod_Malloc/Dmod_Free macros, so no source changes were needed there. The gap is in the DMOD_SYSTEM build branch of CMakeLists.txt (both dmfsi itself and the ramfs example): unlike the DMOD_MODULE branch (which goes through dmod_add_library() and gets DMOD_MODULE_NAME as a compile definition automatically), the DMOD_SYSTEM branch is a plain add_library() with no such definition - so dmod_sal.h now requires DMOD_CURRENT_ALLOCATOR to be set explicitly there.

  • Added dmod_set_current_allocator(dmfsi) to the DMOD_SYSTEM branch of the main CMakeLists.txt.
  • Added the same to examples/ramfs/CMakeLists.txt's DMOD_SYSTEM branch.

Depends on

This needs choco-technologies/dmod#307 merged first.

Test plan

  • Built dmfsi (DMOD_SYSTEM mode) as a dependency of dmvfs, against a local copy of the dmod branch from PR #307 - compiles and links cleanly.
  • CI build.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E7dx6Rd66adYqPjRLyE1GM


Generated by Claude Code

dmfsi's DMOD_SYSTEM branch (both the library itself and the ramfs
example) builds as a plain static library with no DMOD_MODULE_NAME
compile definition - that's only set by dmod_add_library() in the
DMOD_MODULE branch. dmod_sal.h's Dmod_Malloc/Dmod_Free/... (already
used as-is by dmfsi.h's inline helpers and ramfs.c) now require
DMOD_CURRENT_ALLOCATOR to be defined explicitly on that side, so wire
up dmod's dmod_set_current_allocator() helper for both targets.

Requires dmod's DMOD_CURRENT_ALLOCATOR system-side support (see
choco-technologies/dmod#307).
@JohnAmadis
JohnAmadis merged commit af5c4a8 into master Sep 19, 2026
4 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