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

Add docs for supported-vm-packages #46

Open
callendorph opened this issue Apr 12, 2024 · 0 comments
Open

Add docs for supported-vm-packages #46

callendorph opened this issue Apr 12, 2024 · 0 comments

Comments

@callendorph
Copy link
Contributor

From @CuppoJava

What does supported-vm-packages do?

Here is how a user declares an extern function or variable:

extern libfunc: (int, int) -> float
extern libglobal: double

And here is how they are called from Stanza:

val result = call-c libfunc(3, 10)

When the above function call is loaded into the REPL, the JIT produces code that looks like this:

mov 3, ARG0
mov 10, ARG1
call _libfunc

So the JIT is expecting some assembly label called _libfunc to exist, and will call it directly.

This is what supported-vm-packages does. For the packages listed under supported-vm-packages, the compiler expects the libraries containing those labels libfunc, libglobal, etc... to be directly statically linked together with the REPL.

Metaphor with Python

If you attempt to import an OpenGL library in Python, you would need opengl.dll somewhere on your system or else Python will complain that the library cannot be found.
What if you want to build a custom version of Python that has OpenGL directly bundled with it, all in the same executable? So that the Python interpreter directly knows how to handle OpenGL calls, without the user requiring opengl.dll?

Python has its own equivalent to the supported-vm-packages to support this bundling option.

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

No branches or pull requests

1 participant