-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Different DLL names on native dlls for multiple platforms #111833
Comments
Tagging subscribers to this area: @dotnet/interop-contrib |
There is no good built-in way to do this in .NET Framework 4.7. The best you can do is to multi-target your assembly: one build configuration that targets Windows .NET Framework 4.7, and one configuration that targets modern .NET and takes advantage of all new APIs as appropriate (including System.Runtime.InteropServices.NativeLibrary APIs designed for this scenario) It is the approach that we use to solve issues like this in packages published by this repo. For example, System.Data.Odbc package includes multiple configurations: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Data.Odbc/src/System.Data.Odbc.csproj#L4. The Unix configurations have custom native library loading logic: https://github.com/dotnet/runtime/blob/main/src/libraries/Common/src/Interop/Unix/Interop.Odbc.cs#L17-L36 . |
On .NET Core, you can use |
For .Net Framework/Standard you can also PInvoke into |
I try to use a native dll (openssl) on different platforms, and my assembly should also support net 4.7
Now is there a way, to specify different dll names for each platform, but keep the dotnet included native dll resolver?
Problem is, openssl has different dll names on each platform.
And I don't like to copy the the whole imports.
The text was updated successfully, but these errors were encountered: