Fix crash on Linux by DllImporting correct version of libdl#1764
Fix crash on Linux by DllImporting correct version of libdl#1764
DllImporting correct version of libdl#1764Conversation
|
@dotnet-policy-service agree |
|
Hello @Pixelstormer, this is failing the macOS build, I guess we need to either ifdef or do the lookup at runtime. Can you look into it? |
|
So, the problem is that on macOS, libraries use the On an unrelated note, I noticed that the |
|
Cool, that makes sense. Thanks for the contribution. |
CppSharp currently
DllImports thedlopenanddlsymfunctions from the library"dl". This is incorrect however, as described in dotnet/runtime#53291 (comment). Due to the way thatDllImportsearches for libraries, described here, specifying the library name as just"dl"causes it to findlibdl.so, which comes from thelibc6-devpackage, but not the correct version of the library,libdl.so.2. The reason this crashes is becauselibc6-devis not guranteed to be installed everywhere, so on Linux installations where it isn't, such as mine, theDllImportfails and throws an exception.This PR fixes the crash by naming the correct version of the library in the
DllImport, which should always exist.