Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cffi feature #4612

Merged
merged 1 commit into from
Mar 30, 2022
Merged

feat: add cffi feature #4612

merged 1 commit into from
Mar 30, 2022

Conversation

rockstar
Copy link
Contributor

When building the wasm from flux-lsp, the C extern functions are still
provided as part of the public interface for the wasm, despite the
library not ever using them. By putting this behind a (default) feature
flag, and then depending and this crate without the default features, we
trim about 200k from the final wasm binary size.

@rockstar rockstar requested a review from a team as a code owner March 29, 2022 20:02
@rockstar rockstar requested review from Marwes and removed request for a team March 29, 2022 20:02
Copy link
Contributor

@Marwes Marwes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest moving all the functions/impls/etc that are now under the cffi feature into their own module and then re-export them from the root. That way there is less risk that we add a new extern "C" function and forget to put it under the feature.

#[cfg(feature = "cffi")]
mod cffi;
#[cfg(feature = "cffi")]
pub use cffi::{func1, func2};

When building the wasm from `flux-lsp`, the C extern functions are still
provided as part of the public interface for the wasm, despite the
library not ever using them. By putting this behind a (default) feature
flag, and then depending and this crate without the default features, we
trim about 200k from the final wasm binary size.
@rockstar rockstar merged commit e9c0ffe into master Mar 30, 2022
@rockstar rockstar deleted the feat/cffi-feature branch March 30, 2022 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants