fix: export opus and shim symbols from Windows DLL #53
Merged
SineVector241 merged 2 commits intoAvionBlock:masterfrom Apr 10, 2026
Merged
fix: export opus and shim symbols from Windows DLL #53SineVector241 merged 2 commits intoAvionBlock:masterfrom
SineVector241 merged 2 commits intoAvionBlock:masterfrom
Conversation
… exported Without /WHOLEARCHIVE, MSVC link does not export symbols from the static opus.lib into the DLL, resulting in a DLL with zero exports. Linux and macOS already used --whole-archive/-force_load equivalents.
MSVC link does not auto-export symbols from static libs into DLLs (unlike Linux --whole-archive / macOS -force_load). Two changes fix this: - Add SHIM_EXPORT (__declspec(dllexport) on Windows) to all opussharp_* functions in opus_shim.c so they are exported from the DLL. - Generate a .def file from dumpbin /symbols output in the CI Windows build step, listing all opus_* symbols from the static lib, so they are also exported. Replaces the non-functional /WHOLEARCHIVE flag.
SineVector241
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, MSVC link does not automatically export symbols from static
libraries into a DLL (unlike Linux
--whole-archiveor macOS-force_load).This resulted in
opus.dllhaving zero exports, causing P/Invoke failuresat runtime.
Changes
opus_shim.c: AddedSHIM_EXPORTmacro (__declspec(dllexport)onWindows, no-op elsewhere) to all
opussharp_*shim functions so they areexplicitly exported from the DLL.
OpusCompile.yml(Windows build step): Generate a.deffile fromdumpbin /symbolsoutput listing allopus_*symbols from the static lib,then pass
/DEF:opus.defto the linker so those symbols are also exported.This replaces the non-functional
/WHOLEARCHIVEapproach.Verification
Built and tested via CI:
https://github.com/towneh/OpusSharp/actions/runs/24208499689
Resulting
All-Runtimes.zipwas successfully imported into the Basis Unityproject and confirmed working on Windows and macOS. Successfully build Android APK with runtime.