public TestDelegate() { base.Name = "Delegate"; this.nativeLib = new UnmanagedLibrary("Native"); this.doWithNoParameters = this.nativeLib.GetUnmanagedFunction <DelegateWithNoParameters>( "DoWithNoParameters" ); this.doWithInt = this.nativeLib.GetUnmanagedFunction <DelegateWithInt>( "DoWithInt" ); this.doWithDouble = this.nativeLib.GetUnmanagedFunction <DelegateWithDouble>( "DoWithDouble" ); this.doWithIntPointer = this.nativeLib.GetUnmanagedFunction <DelegateWithIntPointer>( "DoWithIntPointer" ); this.doWithDoublePointer = this.nativeLib.GetUnmanagedFunction <DelegateWithDoublePointer>( "DoWithDoublePointer" ); }
public TestCalli() { base.Name = "Calli"; this.nativeLib = new UnmanagedLibrary("Native"); IntPtr nativeMethodAddress = this.nativeLib.GetUnmanagedFunctionAddress( "DoWithNoParameters" ); this.doWithNoParameters = GetCalliDelegate <DelegateWithNoParameters>( nativeMethodAddress ); nativeMethodAddress = this.nativeLib.GetUnmanagedFunctionAddress( "DoWithInt" ); this.doWithInt = GetCalliDelegate <DelegateWithInt>( nativeMethodAddress ); nativeMethodAddress = this.nativeLib.GetUnmanagedFunctionAddress( "DoWithDouble" ); this.doWithDouble = GetCalliDelegate <DelegateWithDouble>( nativeMethodAddress ); nativeMethodAddress = this.nativeLib.GetUnmanagedFunctionAddress( "DoWithIntPointer" ); this.doWithIntPointer = GetCalliDelegate <DelegateWithIntPointer>( nativeMethodAddress ); nativeMethodAddress = this.nativeLib.GetUnmanagedFunctionAddress( "DoWithDoublePointer" ); this.doWithDoublePointer = GetCalliDelegate <DelegateWithDoublePointer>( nativeMethodAddress ); }
public TestDynamicS() { base.Name = "DynamicS"; string libraryName = "Native"; CallingConvention callingConvention = CallingConvention.Cdecl; this.doWithNoParameters = GetDynamicSDelegate <DelegateWithNoParameters>( libraryName, "DoWithNoParameters", callingConvention ); this.doWithInt = GetDynamicSDelegate <DelegateWithInt>( libraryName, "DoWithInt", callingConvention ); this.doWithDouble = GetDynamicSDelegate <DelegateWithDouble>( libraryName, "DoWithDouble", callingConvention ); this.doWithIntPointer = GetDynamicSDelegate <DelegateWithIntPointer>( libraryName, "DoWithIntPointer", callingConvention ); this.doWithDoublePointer = GetDynamicSDelegate <DelegateWithDoublePointer>( libraryName, "DoWithDoublePointer", callingConvention ); }