Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change ~GObject and delete dispose ffi #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/Neo.Cryptography.BLS12_381/GObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,8 @@ public GObject(byte[] g)
{
try
{
switch (type)
{
case GType.G1:
Interop.g1_dispose(ptr);
break;
case GType.G2:
Interop.g2_dispose(ptr);
break;
case GType.Gt:
Interop.gt_dispose(ptr);
break;
default:
throw new Exception($"Bls12381 operation fault, type:format, error:type mismatch");
}
Marshal.FreeHGlobal(ptr);
//ptr = IntPtr.Zero;
}
catch (Exception)
{
Expand Down
9 changes: 0 additions & 9 deletions src/Neo.Cryptography.BLS12_381/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ internal static class Interop
[DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr g2_neg(IntPtr g2);

[DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)]
public static extern void gt_dispose(IntPtr rawPtr);

[DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)]
public static extern void g1_dispose(IntPtr rawPtr);

[DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)]
public static extern void g2_dispose(IntPtr rawPtr);

[DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr g1_g2_pairing(IntPtr g1, IntPtr g2);

Expand Down