dlib icon indicating copy to clipboard operation
dlib copied to clipboard

make crate `#![no_std]` friendly

Open LGFae opened this issue 3 months ago • 1 comments

We can make the crate work in #![no_std] environments with minimal changes. Literally just changing a few imports.

Should be trivial to maintain as well, just make sure to always import from core rather than std. I could maybe try adding a no_std test to make sure the codegen always compiles in no_std environments, if necessary.

LGFae avatar Oct 05 '25 20:10 LGFae

Update: I realized this is less trivial than I first thought, because of this crate's dependency on libloading.

I have implemented a flag such that we only use libloading if std is active. The downside is that dlib cannot use dlopen in no_std environments, and can only support linking directly. I documented this behavior in the top-level doc comment.

I still believe this can be useful, as libraries downstream will be able to support no_std environments, even if with limitations. That said, I can understand if maintainers of this project do not wish to include this.

LGFae avatar Oct 05 '25 23:10 LGFae