DEV Community

IAMMalleshS
IAMMalleshS

Posted on

.NET core APP for Ubuntu

Hi , I am working on one console project which is written on c# .NET core /(NET 5) and i am using below code for windows to load a library.

`[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]

private static extern IntPtr LoadLibrary(String libraryName);

[DllImport("kernel32.dll", CharSet = CharSet.Ansi)]
private static extern IntPtr GetProcAddress(IntPtr libraryHandle, String procedureName);`

what will be the alternative for Ubuntu ?
since Kernel32.dll is win specific - when i publish this code in VS2019 and tried running the APP in Ubuntu machine i got an error as

"Unhandled exception. System.DllNotFoundException: Unable to load shared library 'kernel32.dll'".

Please let me know your inputs to make it work on Ubuntu/Linux machines.

Top comments (0)