© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
25 replies
damia

DllImport Troubles

Hello there. I'm running on linux. I'm trying to load symbols from a library named
libxyz.so
libxyz.so
. I have written it as such:
[DllImport("xyz", EntryPoint = "blahblahblah")]
[DllImport("xyz", EntryPoint = "blahblahblah")]
however, I get this runtime error:
Unhandled Exception. System.DllNotFoundException: Unable to load shared library './xyz' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: ./xyz: cannot open shared object file: No such file or directory
Unhandled Exception. System.DllNotFoundException: Unable to load shared library './xyz' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: ./xyz: cannot open shared object file: No such file or directory
I used the
LD_DEBUG
LD_DEBUG
environment variable as instructed, and discovered that while the runtime is correctly identifying the possible permutations (
xyz
xyz
,
libxyz
libxyz
,
xyz.so
xyz.so
,
libxyz.so
libxyz.so
) it is only searching for those permutations in the system search path (i.e.
/usr/lib
/usr/lib
) and nowhere else. That is to say, it is not searching the current directory, which is where the file is located. How can I remedy this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ DllImport From C Library
C#CC# / help
3y ago
✅ DllImport a C-Styled array
C#CC# / help
4y ago
GC Troubles
C#CC# / help
14mo ago
NativeAOT Serialization Troubles
C#CC# / help
11mo ago