Michal Dobrodenka
Michal Dobrodenka

Reputation: 1134

.Net Core 3.1 - loading native library with extension .so.0 failed

I'm migrating project from mono to .NET Core and I'm using sqlite library.

Following code works as expected in Mono, but not in dotnet:

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Sqlite version: " + Sqlite.LibVersionNumber());
        }
    }

    public static class Sqlite
    {
        const string LibraryPath = "sqlite3";

        [DllImport(LibraryPath, EntryPoint = "sqlite3_libversion_number", CallingConvention = CallingConvention.Cdecl)]
        public static extern int LibVersionNumber();
    }

Problem is, that in /usr/lib I have libsqlite3.so.0 If I rename (or create symlink in /usr/lib) to libsqlite3.so (without .0) everything works correctly in .NET Core.

Is there some switch to load also .so.0 libraries? Is it bug? Or expected feature?

Upvotes: 0

Views: 260

Answers (1)

Marian Blazicek
Marian Blazicek

Reputation: 36

You should allways have the .so and it should allways be a link.

How Do so (Shared Object) Filenames Work?

difference between .so.0 and .so.0.0.0 files

Upvotes: 2

Related Questions