felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=4de94638a645517d9fd23454f81383a531a5c1b2

commit 4de94638a645517d9fd23454f81383a531a5c1b2
Author: Lucas Cavalcante de Sousa <[email protected]>
Date:   Wed Nov 25 10:40:17 2020 -0300

    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
---
 src/bindings/mono/efl_mono/efl_libs.cs.in      |  2 +-
 src/bindings/mono/efl_mono/meson.build         |  5 +++++
 src/bindings/mono/eo_mono/NativeModule_Unix.cs | 16 ++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/bindings/mono/efl_mono/efl_libs.cs.in 
b/src/bindings/mono/efl_mono/efl_libs.cs.in
index fcf5b18183..af811d494a 100644
--- a/src/bindings/mono/efl_mono/efl_libs.cs.in
+++ b/src/bindings/mono/efl_mono/efl_libs.cs.in
@@ -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);
diff --git a/src/bindings/mono/efl_mono/meson.build 
b/src/bindings/mono/efl_mono/meson.build
index 165b6d55bd..5ca6f116d6 100644
--- a/src/bindings/mono/efl_mono/meson.build
+++ b/src/bindings/mono/efl_mono/meson.build
@@ -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'
diff --git a/src/bindings/mono/eo_mono/NativeModule_Unix.cs 
b/src/bindings/mono/eo_mono/NativeModule_Unix.cs
index 67409e02d1..b4dfeb8aea 100644
--- a/src/bindings/mono/eo_mono/NativeModule_Unix.cs
+++ b/src/bindings/mono/eo_mono/NativeModule_Unix.cs
@@ -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);
+                        }
+                    }
+
+
                 }
             }
         }

-- 


Reply via email to