question

FrankNatoli-2507 avatar image
0 Votes"
FrankNatoli-2507 asked cheong00 answered

When using dotnet on Linux, should DllImport reference a Windows DLL or Linux libXXX.so

Have setup dotnet on Linux / Centos8.
Have compiled simple .NET Core C# HelloWorld with Visual Studio on Windows, transferred .NET Core C# DLL to Linux / Centos8, and can run, see "Hello, world" output.
Now need to have .NET Core C# program call functions in Linux / Centos8 libXXX.so file, which of course is a Linux equivalent of DLL.
Get System.DllNotFoundException: Unable to load shared library.
The referenced libXXX.so file is in the same directory as the .NET Core C# DLL, so there should be no problem finding the libXXX.so.
Question then, is can .NET Core C# DLLs call functions in Linux libXXX.so libraries?
Or must .NET Core C# DLLs call functions in Windows DLLs?
Thanks.

dotnet-csharpdotnet-ad
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

cheong00 avatar image
1 Vote"
cheong00 answered

Please check recommendation from Redhat. I think this advice is applicable across different distros.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.