Data-only library as part of cargo build


#1

I’m researching some options for my new library, ICU4RS. When reading about how the other ICU projects package and deliver their i18n data, I found that ICU4C packages its locale data in one dynamic library (in the .rodata section), and its code in another.

How would I deliver my code in, for example, a libicu4rs.so, and the data in libicudata.so? Could I use Cargo for that, or would I need to write an external script to compile the data into a lib?


#2

I actually just found this post: Packaging assets in a library crate which describes packaging resources into the same library as the code using some macros from std. Presumably I could have a .rs file which uses include_bytes!() to include all of the hundreds of resource files; that seems pretty straightforward.