C#C
C#โ€ข2d agoโ€ข
50 replies
AnInternetTroll

Using a static library (.a) in dotnet

Hi. I would like to use a static library (compiled from rust into a .a file) with a dotnet project

I've tried to nudge dotnet into reading the file, but it keeps expecting a shared object (and as such errors out with
invalid ELF header
)

Anyone got any tips?

$ dotnet run -- ../dist/server-entry.js 
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'libssr_cli.a' 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: 
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.1/libssr_cli.a.so: cannot open shared object file: No such file or directory
/workspace/dotnet_src/bin/Debug/net10.0/libssr_cli.a.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.1/liblibssr_cli.a.so: cannot open shared object file: No such file or directory
/workspace/dotnet_src/bin/Debug/net10.0/liblibssr_cli.a.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.1/libssr_cli.a: cannot open shared object file: No such file or directory
/workspace/dotnet_src/bin/Debug/net10.0/libssr_cli.a: invalid ELF header
/usr/share/dotnet/shared/Microsoft.NETCore.App/10.0.1/liblibssr_cli.a: cannot open shared object file: No such file or directory
/workspace/dotnet_src/bin/Debug/net10.0/liblibssr_cli.a: cannot open shared object file: No such file or directory


Excuse the messy project ๐Ÿ˜…
https://codeberg.org/aninternettroll/ssr_cli/src/branch/master/dotnet_src/Program.cs
Was this page helpful?