napi-rs icon indicating copy to clipboard operation
napi-rs copied to clipboard

Allow MSVC build without runtime symbol loading

Open matanui159 opened this issue 11 months ago • 0 comments

I do understand that this is a very specific use case that is not what this project was intended for, but we are trying to link to BabylonNative which provides its own NAPI bindings. Since Babylon Native is in its own DLL rather than the main executable, when Library::this is used on MSVC it fails to load the bindings (we can't statically link it in since the main executable is C#).

I'm wondering if there was a reason why MSVC uses runtime loading of the symbols rather than compile-time linking like all the other platforms, and if you'd be receptive of a change to add a build option to do compile-time linking on MSVC too? We are happy to submit the change if it's something you would be willing to accept.

Maybe it could be a feature like static-symbols which statically links symbols on all platforms including MSVC, in the same way that dyn-symbols dynamically loads symbols on all platforms. With neither defined doing the default for each platform.

matanui159 avatar Jan 16 '25 23:01 matanui159