Saludos. estoy tratanto de descifrar este codigo pero la verdad ya no le entendi.
[Serializable, StructLayout(LayoutKind.Sequential), ComVisible(true)]
public IntPtr = record (ISerializable)
// Methods
constructor IntPtr.Create(value: *);
begin
self.m_value := value
end;
constructor IntPtr.Create(value: Integer);
begin
self.m_value := (value as *)
end;
constructor IntPtr.Create(value: Int64);
begin
self.m_value := ((value as Integer) as *)
end;
constructor IntPtr.Create(info: SerializationInfo; context: StreamingContext);
begin
num := info.GetInt64('value');
if ((IntPtr.Size = 4) and ((num > $7fffffff) or (num < -2147483648))) then
raise ArgumentException.Create(Environment.GetResourceString('Serialization_InvalidPtrValue'));
self.m_value := (num as *)
end;
function IntPtr.Equals(obj: TObject): boolean;
begin
if ((obj is IntPtr)) then
begin
ptr := (obj as IntPtr);
begin
Result := (self.m_value = ptr.m_value);
exit
end
end;
begin
Result := false;
exit
end
end;
function IntPtr.GetHashCode: Integer;
begin
Result := ((self.m_value as UInt64) as Integer)
end;
function IntPtr.IsNull: boolean;
begin
Result := (self.m_value = nil)
end;
operator IntPtr.op_Equality(value1: IntPtr; value2: IntPtr): boolean;
begin
Result := (value1.m_value = value2.m_value)
end;
operator IntPtr.op_Explicit(value: Integer): IntPtr;
begin
Result := IntPtr.Create(value)
end;
operator IntPtr.op_Explicit(value: Int64): IntPtr;
begin
Result := IntPtr.Create(value)
end;
operator IntPtr.op_Explicit(value: IntPtr): Integer;
begin
Result := (value.m_value as Integer)
end;
operator IntPtr.op_Explicit(value: *): IntPtr;
begin
Result := IntPtr.Create(value)
end;
operator IntPtr.op_Explicit(value: IntPtr): *;
begin
Result := value.ToPointer
end;
operator IntPtr.op_Explicit(value: IntPtr): Int64;
begin
Result := ((value.m_value as Integer) as Int64)
end;
operator IntPtr.op_Inequality(value1: IntPtr; value2: IntPtr): boolean;
begin
Result := (value1.m_value <> value2.m_value)
end;
procedure IntPtr.System.Runtime.Serialization.ISerializable.GetObjectData(info: SerializationInfo; context: StreamingContext);
begin
if (info = nil) then
raise ArgumentNullException.Create('info');
info.AddValue('value', ((self.m_value as Integer) as Int64))
end;
function IntPtr.ToInt32: Integer;
begin
Result := (self.m_value as Integer)
end;
function IntPtr.ToInt64: Int64;
begin
Result := ((self.m_value as Integer) as Int64)
end;
function IntPtr.ToPointer: *;
begin
Result := self.m_value
end;
function IntPtr.ToString: string;
begin
num := (self.m_value as Integer);
Result := num.ToString(CultureInfo.InvariantCulture)
end;
function IntPtr.ToString(format: string): string;
begin
num := (self.m_value as Integer);
Result := num.ToString(format, CultureInfo.InvariantCulture)
end;
// Properties
public class property Size: Integer read get_Size;
// Fields
strict private m_value: *;
public class var {readonly} Zero: IntPtr;
end;
Andres