Skip to content

FFI C/C++ with dynamic library icu_capi_cdylib #2791

Answered by sffc
jlfaucher asked this question in Q&A
Discussion options

You must be logged in to vote

The only difference between the staticlib and the cdylib is that one is for static linking and the other one is for dynamic linking. The cdylib has ABI stability, so you can swap in an ICU4X update in the future and callers should continue to work without having to be re-compiled. With the static lib, you need to re-compile the callers, but the advantage is that you only ship what you use.

The way to get the smallest code sizes is to static-link ICU4X and run it through LTO. You should also build ICU4X with panic=abort for additional savings. See here for an example of the size-optimized ICU4X build over FFI:

https://github.com/unicode-org/icu4x/tree/main/ffi/diplomat/c/examples/fixeddeci…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jlfaucher
Comment options

Answer selected by jlfaucher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants