This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/29/head
in repository efl.

View the commit online.

commit e5b4a438d95a86ff5304bfc5b9881d59bc1a1806
Author: Ryan Gammon <r...@gamnation.net>
AuthorDate: Wed Jun 21 06:47:33 2023 -0700

    Fix up windows build of mono bindings
---
 src/bindings/mono/efl_sharp.csproj.in              |  2 +-
 src/bindings/mono/eo_mono/FunctionWrapper_Unix.cs  |  4 ++++
 .../mono/eo_mono/FunctionWrapper_Windows.cs        | 15 +++++++++++----
 src/bindings/mono/eo_mono/NativeModule_Unix.cs     |  4 ++++
 src/bindings/mono/eo_mono/NativeModule_Windows.cs  | 22 +++++++++++++++++++---
 src/bindings/mono/eo_mono/meson.build              | 12 +++++-------
 6 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/src/bindings/mono/efl_sharp.csproj.in b/src/bindings/mono/efl_sharp.csproj.in
index e03be33950..94e092e16a 100644
--- a/src/bindings/mono/efl_sharp.csproj.in
+++ b/src/bindings/mono/efl_sharp.csproj.in
@@ -22,7 +22,7 @@
   <ItemGroup>
     <Compile Include="@BINDING_SRC@/efl_mono/*.cs" />
     <!-- FIXME Windows support -->
-    <Compile Include="@BINDING_SRC@/eo_mono/*.cs" Exclude="@BINDING_SRC@/eo_mono/*Windows.cs" />
+    <Compile Include="@BINDING_SRC@/eo_mono/*.cs" />
     <Compile Include="@BINDING_SRC@/eina_mono/*.cs" />
     <Compile Include="@BINDING_SRC@/eolian_mono/*.cs" />
     <Compile Include="@BINDING_SRC@/eldbus_mono/*.cs" />
diff --git a/src/bindings/mono/eo_mono/FunctionWrapper_Unix.cs b/src/bindings/mono/eo_mono/FunctionWrapper_Unix.cs
index 636f83ebb1..604fbee111 100644
--- a/src/bindings/mono/eo_mono/FunctionWrapper_Unix.cs
+++ b/src/bindings/mono/eo_mono/FunctionWrapper_Unix.cs
@@ -13,6 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#if !WIN32
+
 using System;
 using System.Runtime.InteropServices;
 
@@ -40,3 +42,5 @@ internal static partial class FunctionInterop
 }
 
 }
+
+#endif
\ No newline at end of file
diff --git a/src/bindings/mono/eo_mono/FunctionWrapper_Windows.cs b/src/bindings/mono/eo_mono/FunctionWrapper_Windows.cs
index 1ff7627a2f..c0708d7b27 100644
--- a/src/bindings/mono/eo_mono/FunctionWrapper_Windows.cs
+++ b/src/bindings/mono/eo_mono/FunctionWrapper_Windows.cs
@@ -13,19 +13,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+#if WIN32
+
 using System;
 using System.Runtime.InteropServices;
 
 namespace Efl.Eo
 {
 
-static partial class FunctionInterop
+internal static partial class FunctionInterop
 {
-    [DllImport(efl.Libs.Libdl)]
+    [DllImport(efl.Libs.Kernel32, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
     internal static extern IntPtr GetProcAddress(IntPtr handle, string symbol);
 
-    private static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName)
-        => FunctionInterop.GetProcAddress(nativeLibraryHandle, functionName);
+    private static IntPtr dlsym(IntPtr handle, string symbol) => FunctionInterop.GetProcAddress(handle, symbol);
+
+    internal static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName) =>
+        FunctionInterop.GetProcAddress(nativeLibraryHandle, functionName);
 }
 
 }
+
+#endif
\ No newline at end of file
diff --git a/src/bindings/mono/eo_mono/NativeModule_Unix.cs b/src/bindings/mono/eo_mono/NativeModule_Unix.cs
index b4dfeb8aea..7059715062 100644
--- a/src/bindings/mono/eo_mono/NativeModule_Unix.cs
+++ b/src/bindings/mono/eo_mono/NativeModule_Unix.cs
@@ -13,6 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#if !WIN32
+
 using System;
 using System.Runtime.InteropServices;
 
@@ -98,3 +100,5 @@ internal partial class NativeModule
 }
 
 }
+
+#endif
\ No newline at end of file
diff --git a/src/bindings/mono/eo_mono/NativeModule_Windows.cs b/src/bindings/mono/eo_mono/NativeModule_Windows.cs
index 513eb723e1..88d7d3d363 100644
--- a/src/bindings/mono/eo_mono/NativeModule_Windows.cs
+++ b/src/bindings/mono/eo_mono/NativeModule_Windows.cs
@@ -13,16 +13,32 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#if WIN32
+
 using System;
 using System.Runtime.InteropServices;
 
 namespace Efl.Eo
 {
 
-internal class partial NativeModule
+internal partial class NativeModule
 {
-   [DllImport(efl.Libs.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
-   internal static extern IntPtr LoadLibrary(string libFilename);
+    [DllImport(efl.Libs.Kernel32, EntryPoint = "LoadLibrary", CharSet = CharSet.Unicode, SetLastError = true)]
+    private static extern IntPtr _LoadLibrary(string libFilename);
+
+    internal static IntPtr LoadLibrary(string libFilename)
+    {
+        if (!libFilename.StartsWith("lib"))
+        {
+                libFilename = "lib" + libFilename + "-1";
+        }
+        return NativeModule._LoadLibrary(libFilename);
+    }
+
+    [DllImport(efl.Libs.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+    internal static extern void UnloadLibrary(IntPtr handle);
 }
 
 }
+
+#endif
\ No newline at end of file
diff --git a/src/bindings/mono/eo_mono/meson.build b/src/bindings/mono/eo_mono/meson.build
index 013b1cc97f..719d575486 100644
--- a/src/bindings/mono/eo_mono/meson.build
+++ b/src/bindings/mono/eo_mono/meson.build
@@ -4,11 +4,9 @@ mono_files += files(
   'FunctionWrapper.cs',
   'NativeModule.cs',
   'EoWrapper.cs',
-  'WrapperSupervisor.cs'
+  'WrapperSupervisor.cs',
+  'FunctionWrapper_Windows.cs',
+  'NativeModule_Windows.cs',
+  'FunctionWrapper_Unix.cs',
+  'NativeModule_Unix.cs'
 )
-
-if host_machine.system() == 'windows'
-   mono_files += files('FunctionWrapper_Windows.cs', 'NativeModule_Windows.cs')
-else
-   mono_files += files('FunctionWrapper_Unix.cs', 'NativeModule_Unix.cs')
-endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to