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 IO for loading and calling dynamically linked libraries #621

Closed
developedby opened this issue Jul 7, 2024 · 0 comments · Fixed by #624
Closed

Add IO for loading and calling dynamically linked libraries #621

developedby opened this issue Jul 7, 2024 · 0 comments · Fixed by #624
Labels
enhancement New feature or request HVM About the HVM prelude Bend's builtin types and functions

Comments

@developedby
Copy link
Member

Is your feature request related to a problem? Please describe.
Hvm added dylib support in HigherOrderCO/HVM#394, but it was never added to Bend.

Describe the solution you'd like
Expose the dylib functions dl_open, dl_call, dl_close with a user friendly interface, like we did for files.

# 'path' is the path to the dl file.
# 'lazy' is a boolean encoded as a u24 that determines if all functions are loaded lazily or upfront.
# Returns an unique id to the dl object encoded as a u24
IO/DyLib/open : (path: String) -> (lazy: u24) -> u24

# Calls a function of a previously opened dylib.
# 'dl' is the id of the dl object
# 'fn' is the name of the function in the dylib
# 'args' are the arguments to the function. The expected values depend on the called function.
# The returned value is determined by the called function.
IO/DyLib/call : (dl: u24) -> (fn: String) -> (args: Any) -> Any

# Closes a previously open dylib.
# 'dl' is the id of the dylib.
# Returns nothing.
IO/DyLib/close : (dl: u24) -> None

We should also include some documentation with an example program to be compiled as a dll an loaded into bend.

@developedby developedby added enhancement New feature or request HVM About the HVM prelude Bend's builtin types and functions labels Jul 7, 2024
@developedby developedby linked a pull request Jul 8, 2024 that will close this issue
@developedby developedby changed the title Add IO for loading and calling dynamicly linked libraries Add IO for loading and calling dynamically linked libraries Jul 18, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 22, 2024
…-calling-dynamicly-linked-libraries

#621 Add dylib IO functions
@developedby developedby added this to the IO lib v0 milestone Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request HVM About the HVM prelude Bend's builtin types and functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant