Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement resource bundling and loading into the executable #91

Open
jeaye opened this issue Aug 29, 2024 · 0 comments
Open

Implement resource bundling and loading into the executable #91

jeaye opened this issue Aug 29, 2024 · 0 comments

Comments

@jeaye
Copy link
Member

jeaye commented Aug 29, 2024

This is a very handy feature of the JVM and JAR file structure. We can replicate it in C++, but it will require some platform-specific tooling. Some cursory search shows that ld can do this for us: https://stackoverflow.com/a/11622727

Interestingly, the asm then required to access the objects will need to be JIT compiled, so we'll have to see how well that works and if the symbols can be found.

I think there are other approaches which don't embed resource into the executable itself, such as AppImages, but they're even less cross-platform. I would like for jank's AOT compiled programs to just be standalone, but I will settle for AppImages if necessary.

So, the way this would look is that jank needs to:

  1. Know the resource paths
  2. Provide some functions á la io/resource
  3. Search the resource paths (on the fs)
  4. Fall back to searching the resource paths within the application
  5. During AOT compilation, bundle all files within the resource paths into the application and build a map of file path -> pointer+size
  6. Ensure all of this works on Linux and macOS (Windows will need special handling and is not a high priority for jank at this time)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant