1
1
using System ;
2
+ using System . Runtime . CompilerServices ;
2
3
using System . Runtime . InteropServices ;
3
4
4
- public unsafe partial class NativeMethods
5
+ public static partial class NativeMethods
5
6
{
6
7
#if DEBUG
7
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
8
+ private const string LibName = "appMpower.Orm.dylib" ;
8
9
#else
9
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
10
- #endif
11
- public static extern void Dbms ( int dbms ) ;
10
+ private const string LibName = "appMpower.Orm.so" ;
11
+ #endif
12
12
13
- #if DEBUG
14
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
15
- #else
16
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
17
- #endif
18
- public static extern void DbProvider ( int dbProvider ) ;
13
+ [ LibraryImport ( LibName , EntryPoint = "Dbms" , StringMarshalling = StringMarshalling . Utf16 ) ]
14
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
15
+ public static partial void Dbms ( int dbms ) ;
19
16
20
- #if DEBUG
21
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl ) ]
22
- #else
23
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl ) ]
24
- #endif
25
- public static extern void FreeHandlePointer ( IntPtr handlePointer ) ;
17
+ [ LibraryImport ( LibName , EntryPoint = "DbProvider" , StringMarshalling = StringMarshalling . Utf16 ) ]
18
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
19
+ public static partial void DbProvider ( int dbProvider ) ;
26
20
27
- #if DEBUG
28
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
29
- #else
30
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
31
- #endif
32
- //public static extern byte* Db(out int length);
33
- public static extern IntPtr Db ( out int length , out IntPtr handlePointer ) ;
21
+ [ LibraryImport ( LibName , EntryPoint = "FreeHandlePointer" ) ]
22
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
23
+ public static partial void FreeHandlePointer ( IntPtr handlePointer ) ;
34
24
35
- #if DEBUG
36
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
37
- #else
38
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
39
- #endif
40
- public static extern IntPtr Fortunes ( out int length , out IntPtr handlePointer ) ;
25
+ [ LibraryImport ( LibName , EntryPoint = "Db" , StringMarshalling = StringMarshalling . Utf16 ) ]
26
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
27
+ public static partial IntPtr Db ( out int length , out IntPtr handlePointer ) ;
41
28
42
- #if DEBUG
43
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
44
- #else
45
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
46
- #endif
47
- public static extern IntPtr Query ( int queries , out int length , out IntPtr handlePointer ) ;
29
+ [ LibraryImport ( LibName , EntryPoint = "Fortunes" , StringMarshalling = StringMarshalling . Utf16 ) ]
30
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
48
31
49
- #if DEBUG
50
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
51
- #else
52
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
53
- #endif
54
- public static extern IntPtr Updates ( int queries , out int length , out IntPtr handlePointer ) ;
32
+ public static partial IntPtr Fortunes ( out int length , out IntPtr handlePointer ) ;
55
33
56
- #if DEBUG
57
- [ DllImport ( "appMpower.Orm.dylib" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
58
- #else
59
- [ DllImport ( "appMpower.Orm.so" , CallingConvention = CallingConvention . Cdecl , CharSet = CharSet . Unicode ) ]
60
- #endif
61
- public static extern IntPtr DbById ( int id , out int length , out IntPtr handlePointer ) ;
62
- }
34
+ [ LibraryImport ( LibName , EntryPoint = "Query" , StringMarshalling = StringMarshalling . Utf16 ) ]
35
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
36
+ public static partial IntPtr Query ( int queries , out int length , out IntPtr handlePointer ) ;
37
+
38
+ [ LibraryImport ( LibName , EntryPoint = "Updates" , StringMarshalling = StringMarshalling . Utf16 ) ]
39
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
40
+ public static partial IntPtr Updates ( int queries , out int length , out IntPtr handlePointer ) ;
41
+
42
+ [ LibraryImport ( LibName , StringMarshalling = StringMarshalling . Utf16 ) ]
43
+ [ UnmanagedCallConv ( CallConvs = new [ ] { typeof ( CallConvCdecl ) } ) ]
44
+ public static partial IntPtr DbById ( int id , out int length , out IntPtr handlePointer ) ;
45
+
46
+ }
0 commit comments