public static bool GetLastError(CBase AInstance, out String AErrorMessage) { Byte resultHasError = 0; UInt32 sizeErrorMessage = 0; UInt32 neededErrorMessage = 0; CheckError(Internal.LibPrimesWrapper.GetLastError(AInstance.GetHandle(), sizeErrorMessage, out neededErrorMessage, IntPtr.Zero, out resultHasError)); sizeErrorMessage = neededErrorMessage; byte[] bytesErrorMessage = new byte[sizeErrorMessage]; GCHandle dataErrorMessage = GCHandle.Alloc(bytesErrorMessage, GCHandleType.Pinned); CheckError(Internal.LibPrimesWrapper.GetLastError(AInstance.GetHandle(), sizeErrorMessage, out neededErrorMessage, dataErrorMessage.AddrOfPinnedObject(), out resultHasError)); dataErrorMessage.Free(); AErrorMessage = Encoding.UTF8.GetString(bytesErrorMessage).TrimEnd(char.MinValue); return(resultHasError != 0); }
public static void ReleaseInstance(CBase AInstance) { CheckError(Internal.LibPrimesWrapper.ReleaseInstance(AInstance.GetHandle())); }