Skip to content

Add runtime config option for static linkage #625

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

Open
wants to merge 1 commit into
base: no-xamarin
Choose a base branch
from

Conversation

am11
Copy link

@am11 am11 commented Mar 26, 2025

This adds the ability to use statically linked binary to self using modern .NET interop APIs.

To opt-in, the consumer project file would have:

<ItemGroup>
  <RuntimeHostConfigurationOption Include="SQLitePCL.LinkageType.Static" Value="true" />
</ItemGroup>

or AppContext.SetSwitch("SQLitePCL.LinkageType.Static", true); in their initialization code (e.g. in their module initializer or some other static context).

https://learn.microsoft.com/dotnet/core/runtime-config/
https://learn.microsoft.com/dotnet/api/system.appcontext.setswitch

@am11
Copy link
Author

am11 commented Mar 26, 2025

@ericsink this is related to #582. I've used no-xamarin branch.

Another aspect of this work is to actually pack static libs alongside the dynamic libs in the nuget package, so users can link it in projects without needing to build ericsink/cb repo with -static option manually. e.g. browser-wasm is shipped with e_sqlite3.a only while linux-x64 is shipped with libe_sqlite3.so only. Would be nice to have static flavors for desktop runtimes as well.

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.

1 participant