private void CallUnamanged()
        {
            IntPtr dll = NativeMethods.LoadLibrary(Path);

            if (dll == IntPtr.Zero)
            {
                throw new Exception("Can't open DLL file!");
            }
            IntPtr procAddr = NativeMethods.GetProcAddress(dll, Identifier);

            if (procAddr == IntPtr.Zero)
            {
                throw new Exception("Can't find " + Identifier + " in DLL!");
            }
            UnmanagedCallback callback = (UnmanagedCallback)
                                         Marshal.GetDelegateForFunctionPointer(procAddr, typeof(UnmanagedCallback));

            callback(Body);
            NativeMethods.FreeLibrary(dll);
        }
Beispiel #2
0
 static public extern int setCallback(UnmanagedCallback callback);
Beispiel #3
0
 public static extern int setCallback(UnmanagedCallback callback);