Skip to content

Cannot get the examle to link as a static library #2

@ShackGH

Description

@ShackGH

Trying to test this in linux with net8.0, I've changed the .csproj as it complained that it couldn't find the lib path. But now am getting an error when running the app saying as follows;

System.DllNotFoundException: Unable to load shared library 'nativelib' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/workspaces/Test/app/bin/Debug/net8.0/linux-x64/nativelib.so: cannot open shared object file: No such file or directory
/workspaces/Test/app/bin/Debug/net8.0/linux-x64/libnativelib.so: cannot open shared object file: No such file or directory
/workspaces/Test/app/bin/Debug/net8.0/linux-x64/nativelib: cannot open shared object file: No such file or directory
/workspaces/Test/app/bin/Debug/net8.0/linux-x64/libnativelib: cannot open shared object file: No such file or directory

The .csproj changes

    <ItemGroup>
        <!-- Generate direct PInvokes for Dependency -->
        <DirectPInvoke Include="nativelib" />
        <!-- Specify library to link against -->
        <NativeLibrary Include="../clib/nativelib.a" />
    </ItemGroup>

looks like it's not trying to link a static lib and is expecting a dynamic lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions