|
@@ -1,62 +1,46 @@
|
|
using System;
|
|
using System;
|
|
|
|
+using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
-public unsafe partial class NativeMethods
|
|
|
|
|
|
+public static partial class NativeMethods
|
|
{
|
|
{
|
|
#if DEBUG
|
|
#if DEBUG
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
|
|
+ private const string LibName = "appMpower.Orm.dylib";
|
|
#else
|
|
#else
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- public static extern void Dbms(int dbms);
|
|
|
|
|
|
+ private const string LibName = "appMpower.Orm.so";
|
|
|
|
+#endif
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- public static extern void DbProvider(int dbProvider);
|
|
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "Dbms", StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial void Dbms(int dbms);
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
-#endif
|
|
|
|
- public static extern void FreeHandlePointer(IntPtr handlePointer);
|
|
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "DbProvider", StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial void DbProvider(int dbProvider);
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- //public static extern byte* Db(out int length);
|
|
|
|
- public static extern IntPtr Db(out int length, out IntPtr handlePointer);
|
|
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "FreeHandlePointer")]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial void FreeHandlePointer(IntPtr handlePointer);
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- public static extern IntPtr Fortunes(out int length, out IntPtr handlePointer);
|
|
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "Db", StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial IntPtr Db(out int length, out IntPtr handlePointer);
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- public static extern IntPtr Query(int queries, out int length, out IntPtr handlePointer);
|
|
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "Fortunes", StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- public static extern IntPtr Updates(int queries, out int length, out IntPtr handlePointer);
|
|
|
|
|
|
+ public static partial IntPtr Fortunes(out int length, out IntPtr handlePointer);
|
|
|
|
|
|
-#if DEBUG
|
|
|
|
- [DllImport("appMpower.Orm.dylib", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#else
|
|
|
|
- [DllImport("appMpower.Orm.so", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
|
|
|
|
-#endif
|
|
|
|
- public static extern IntPtr DbById(int id, out int length, out IntPtr handlePointer);
|
|
|
|
-}
|
|
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "Query", StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial IntPtr Query(int queries, out int length, out IntPtr handlePointer);
|
|
|
|
+
|
|
|
|
+ [LibraryImport(LibName, EntryPoint = "Updates", StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial IntPtr Updates(int queries, out int length, out IntPtr handlePointer);
|
|
|
|
+
|
|
|
|
+ [LibraryImport(LibName, StringMarshalling = StringMarshalling.Utf16)]
|
|
|
|
+ [UnmanagedCallConv(CallConvs = new[] { typeof(CallConvCdecl) })]
|
|
|
|
+ public static partial IntPtr DbById(int id, out int length, out IntPtr handlePointer);
|
|
|
|
+
|
|
|
|
+}
|