Add include-header macro - #942
Open
djblue wants to merge 4 commits into
Open
Conversation
djblue
marked this pull request as ready for review
August 2, 2026 23:40
jeaye
requested changes
Aug 3, 2026
jeaye
left a comment
Member
There was a problem hiding this comment.
Thanks for your continued help, Chris. 🙂
From what I can tell, this PR works around the clojure.core issue, but it doesn't provide a solution for every other user's includes. We don't want everyone to need to follow this same pattern of bootstrapping. Also, we need this to work for C++ output targets --output-target cpp, which is why I believe the special form is needed.
It may be helpful to clarify that the _static.cpp files are only ever linked into an AOT binary with a static runtime. So, for header inclusion, there's nothing for them to do at all. That part is right for load_header, but include_header shouldn't need to do anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before digging into making this a special form, I wanted to get something working to test our theories. The code in this PR seems to be working for me, however going through
eval_cpp_stringappears to be causing issues:void load_header(jtl::immutable_string const &header) { - __rt_ctx->eval(cpp_raw_include(header)); + auto const cpp(header.starts_with("./") ? util::format("#include \"{}\"", header) + : util::format("#include <{}>", header)); + __rt_ctx->eval_cpp_string(cpp).expect_ok(); }Will cause the following error on compile: