public void Update(Object obj) { try { IntPtr buffer = Marshal.AllocHGlobal(Marshal.SizeOf(obj.GetType())); Marshal.StructureToPtr(obj, buffer, true); CppToCsharpAdapter.Update(my_hash_file_pointer, buffer); Marshal.FreeHGlobal(buffer); } catch (SEHException ex) { string message = CppToCsharpAdapter.GetLastErrorMessage(this.my_hash_file_pointer); throw new Exception(message); } catch { throw; } }