efl-mono: Correctly load dynamic libs for OSX

Summary:
OSX libs end with `.dylib`, so it made failed to load libs, for instance
dl name is `dl.dylib` making it unable to load as it was before
(`libdl.so`).

Test Plan:
Compare with master and note that this diff is able to fail on tests, and
not about importing libs.
- Configure as especified by Enlightenment man page + `-Dbindigns=mono -Ddotnet=true`:
```
meson -Dsystemd=false -Dv4l2=false -Davahi=false -Deeze=false -Dx11=false -Dopengl=full -Dcocoa=true -Dnls=false -Demotion-loaders-disabler=gstreamer1,libvlc,xine -Decore-imf-loaders-disabler=scim,ibus -Dbindigns=cxx,mono -Ddotnet=true --prefix=$PWD/prefix build
```
- Build normally
- Test `efl-mono-suite`

Reviewers: felipealmeida

Reviewed By: felipealmeida

Subscribers: stefan_schmidt, cedric, #reviewers, #committers, woohyun

Tags: #efl, #expertise_solutions

Differential Revision: https://phab.enlightenment.org/D12156
This commit is contained in:
Lucas Cavalcante de Sousa 2020-11-25 10:40:17 -03:00 committed by Felipe Magno de Almeida
parent ccc1849263
commit 4de94638a6
3 changed files with 22 additions and 1 deletions

View File

@ -33,7 +33,7 @@ internal class Libs {
internal const string CustomExports = "@CUSTOM_EXPORTS_MONO_DL_MONO@";
internal const string Libdl = "libdl.so";
internal const string Libdl = "@LIBDL_DL_MONO@";
internal const string Kernel32 = "kernel32.dll";
internal static readonly Efl.Eo.NativeModule EflModule = new Efl.Eo.NativeModule(Efl);

View File

@ -16,6 +16,11 @@ efl_libs = configuration_data()
efl_libs.set('EFL_MONO_LIBRARY_MAP', map)
efl_libs.set('CUSTOM_EXPORTS_MONO_DL_MONO', 'eflcustomexportsmono')
efl_libs.set('EVIL_DL_MONO', 'dl')
if sys_osx
efl_libs.set('LIBDL_DL_MONO', 'dl.dylib')
else
efl_libs.set('LIBDL_DL_MONO', 'libdl.so')
endif
foreach mono_libs : mono_sublibs
key = mono_libs[0].to_upper()+'_DL_MONO'

View File

@ -56,6 +56,12 @@ internal partial class NativeModule
///<item>
///<description><c>libfilename.so</c></description>
///</item>
///<item>
///<description><c>filename.dylib</c></description>
///</item>
///<item>
///<description><c>libfilename.dylib</c></description>
///</item>
///</list>
///</summary>
///<param name="filename">The name to search for.</param>
@ -73,6 +79,16 @@ internal partial class NativeModule
if (r == IntPtr.Zero)
{
r = dlopen("lib" + filename + ".so", RTLD_NOW | RTLD_GLOBAL);
if (r == IntPtr.Zero)
{
r = dlopen(filename + ".dylib", RTLD_NOW | RTLD_GLOBAL);
if (r == IntPtr.Zero)
{
r = dlopen("lib" + filename + ".dylib", RTLD_NOW | RTLD_GLOBAL);
}
}
}
}
}