Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix bool arg mangling on MsvcAbi and add ability to read Double and Int64 fields #4

Open
wants to merge 2 commits into from

1 participant

@trustme

The current MsvcAbi implementation did not support bool args. I did not look for other missing mangles. Also added reading double and long fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2012
  1. Add name mangling for bool in MsvcAbi

    Duane Wandless authored
  2. Add ability to read Double and Int64 fields

    Duane Wandless authored
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 0 deletions.
  1. +3 −0  src/Mono.Cxxi/Abi/Impl/MsvcAbi.cs
  2. +14 −0 src/Mono.Cxxi/CppField.cs
View
3  src/Mono.Cxxi/Abi/Impl/MsvcAbi.cs
@@ -210,6 +210,9 @@ public virtual string GetTypeCode (CppType mangleType)
code.Append(mangleType.ElementTypeName);
code.Append ("@@");
break;
+ case CppTypes.Bool:
+ code.Append("_N");
+ break;
}
return code.ToString ();
View
14 src/Mono.Cxxi/CppField.cs
@@ -53,6 +53,20 @@ public CppField (int fieldOffset)
retVal = Marshal.ReadInt16 (ip.Native, fieldOffset);
else if (retType.Equals (typeof (Int32)))
retVal = Marshal.ReadInt32 (ip.Native, fieldOffset);
+ else if (retType.Equals(typeof(Double)))
+ {
+ IntPtr doubleStart = new IntPtr(ip.Native.ToInt64() + fieldOffset);
+ byte[] buffer = new byte[8];
+ Marshal.Copy(doubleStart, buffer, 0, 8);
+ retVal = BitConverter.ToDouble(buffer, 0);
+ }
+ else if (retType.Equals(typeof(Int64)))
+ {
+ IntPtr doubleStart = new IntPtr(ip.Native.ToInt64() + fieldOffset);
+ byte[] buffer = new byte[8];
+ Marshal.Copy(doubleStart, buffer, 0, 8);
+ retVal = BitConverter.ToInt64(buffer, 0);
+ }
else if (typeof (ICppObject).IsAssignableFrom (retType)) {
Something went wrong with that request. Please try again.