Skip to content

What's the correct way to use Steel's own dylibs? #387

@tesujimath

Description

@tesujimath

I am interested in using steel-regex in my own application. This is not installed by cargo xtask install.

I was able to use it by doing this:

aya> cd libs/steel-regex
aya> cargo steel-lib
    Finished `release` profile [optimized + debuginfo] target(s) in 1m 18s
Found a cdylib!
Copying /home/sjg/vc/third-party/steel/target/release/libsteel_regex.so to /home/sjg/.steel/native/libsteel_regex.so
Done!

and successfully used it like this:

λ > (#%require-dylib "libsteel_regex" (only-in regex regex/match?))
λ > (define abc-re (regex "abc"))
λ > (regex/match? abc-re "xyz")
=> #false
λ > (regex/match? abc-re "xyzabcz")
=> #true

My question is about how to package this up for use in my application so that my own users don't have to grapple with such things themselves.

For several of Steel's dylibs there is an associated Scheme file which contains the #%require-dylib such as I used above, e.g. steel-rustls has one. This is currently missing for steel-regex (steel-regex/regex.scm is an empty file). This Scheme wrapper hides from the user that the library is a dylib rather than a simple Scheme cog, so such wrappers are clearly required.

I think what is needed is addition of the missing Scheme wrappers, than a cargo xtask rule to build and install them.

Is this right?

(I also see quite a bit of infrastructure for package management, but I am unclear on the status of this, and whether it is intended for Steel's own native dylibs or just for third party packages. There are a couple of old issues touching on this, but I think things have moved on since then.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions