inkwell icon indicating copy to clipboard operation
inkwell copied to clipboard

Change the unsafe API from `pub(crate)` to `pub`/`pub unsafe`.

Open ErisianArchitect opened this issue 3 months ago • 4 comments

Is your feature request related to a problem? Please describe. I was working on support for the Orc JIT engine, and I came to a point where I needed to create an LLVMString, but I didn't have the capability because all of the creation functions were private to the inkwell crate, and I was working from a separate experiments crate. It makes sense to me to keep the unsafe API public so that inkwell can be extended by other crates.

Describe the solution you'd like Make all of the unsafe API in inkwell public.

Describe possible drawbacks to your solution In a sense, it could change the meaning of "safe wrapper" by making all of these things open, but perhaps it could be a feature flag.

Describe alternatives you've considered The only other alternative is to make my own types, but that may not be ideal.

ErisianArchitect avatar Sep 06 '25 04:09 ErisianArchitect

I don't follow; the Orc JIT is in Inkwell, so why does LLVMString need to be externally createable?

TheDan64 avatar Sep 28 '25 07:09 TheDan64

At first, I was working on Orc JIT in an experimental repo. It made me realize that there might be someone that would want to implement their own extensions to inkwell, but they would have trouble without access to the private api.

ErisianArchitect avatar Sep 28 '25 16:09 ErisianArchitect

In general I've started opening up types' new methods to be public, but it's not clear to me how that would be useful for LLVMString - the type's intention is purely for getting strings from llvm, not so much creating your own

TheDan64 avatar Sep 29 '25 03:09 TheDan64

In general I've started opening up types' new methods to be public, but it's not clear to me how that would be useful for LLVMString - the type's intention is purely for getting strings from llvm, not so much creating your own It's useful when you already have a C string produced by LLVM and you want to give it a safe wrapper.

ErisianArchitect avatar Sep 29 '25 06:09 ErisianArchitect