diff --git a/src/Mono.Cxxi/Abi/Impl/VirtualOnlyAbi.cs b/src/Mono.Cxxi/Abi/Impl/VirtualOnlyAbi.cs deleted file mode 100644 index f04aa166..00000000 --- a/src/Mono.Cxxi/Abi/Impl/VirtualOnlyAbi.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Mono.Cxxi.Abi.VirtualOnlyAbi.cs: A generalized C++ ABI that only supports virtual methods -// -// Author: -// Alexander Corrado (alexander.corrado@gmail.com) -// Andreia Gaita (shana@spoiledcat.net) -// -// Copyright (C) 2010-2011 Alexander Corrado -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -using System; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.InteropServices; - -namespace Mono.Cxxi.Abi { - - public class VirtualOnlyAbi : CppAbi { - - public VirtualOnlyAbi (MemberFilter vtableOverrideFilter) - { - this.vtable_override_filter = vtableOverrideFilter; - } - public VirtualOnlyAbi () { } - - public override MethodType GetMethodType (CppTypeInfo typeInfo, MethodInfo imethod) - { - MethodType defaultType = base.GetMethodType (typeInfo, imethod); - if (defaultType == MethodType.NativeCtor || defaultType == MethodType.NativeDtor) - return MethodType.NoOp; - return defaultType; - } - - protected override string GetMangledMethodName (CppTypeInfo typeInfo, MethodInfo methodInfo) - { - throw new NotSupportedException ("Name mangling is not supported by this class. All C++ interface methods must be declared virtual."); - } - - public override CallingConvention? GetCallingConvention (MethodInfo methodInfo) - { - // Use platform default - return null; - } - } -} - diff --git a/src/Mono.Cxxi/CppInstancePtr.cs b/src/Mono.Cxxi/CppInstancePtr.cs index dd3e8403..91a9b6c0 100644 --- a/src/Mono.Cxxi/CppInstancePtr.cs +++ b/src/Mono.Cxxi/CppInstancePtr.cs @@ -40,37 +40,8 @@ namespace Mono.Cxxi { private IntPtr ptr, native_vtptr; private bool manage_memory; - private static Dictionary implCache = null; private static Dictionary managed_vtptr_to_gchandle_offset = null; - // TODO: the managed instance argument may only be NULL if all methods in TWrapper - // that correspond to the virtual methods in Iface are static. - public static CppInstancePtr ForManagedObject (TWrapper managed) - where Iface : ICppClassOverridable - { - object cachedImpl; - Iface impl; - - if (implCache == null) - implCache = new Dictionary (); - - if (!implCache.TryGetValue (typeof (Iface), out cachedImpl)) - { - // FIXME: fix this? or not... - //VirtualOnlyAbi virtualABI = new VirtualOnlyAbi (VTable.BindToSignature); - //impl = virtualABI.ImplementClass (typeof (TWrapper), new CppLibrary (string.Empty), string.Empty); - //implCache.Add (typeof (Iface), impl); - throw new NotImplementedException (); - } - else - impl = (Iface)cachedImpl; - - CppInstancePtr instance = impl.Alloc (managed); - impl.TypeInfo.VTable.InitInstance (ref instance); - - return instance; - } - // Alloc a new C++ instance internal CppInstancePtr (CppTypeInfo typeInfo, object managedWrapper) { diff --git a/src/Mono.Cxxi/CppObjectMarshaler.cs b/src/Mono.Cxxi/CppObjectMarshaler.cs deleted file mode 100644 index a55acac0..00000000 --- a/src/Mono.Cxxi/CppObjectMarshaler.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Author: -// Alexander Corrado (alexander.corrado@gmail.com) -// Andreia Gaita (shana@spoiledcat.net) -// -// Copyright (C) 2010-2011 Alexander Corrado -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -using System; -using System.Runtime.InteropServices; - -namespace Mono.Cxxi { - public class CppObjectMarshaler : ICustomMarshaler { - private static CppObjectMarshaler marshaler = null; - private CppObjectMarshaler () { - } - - public IntPtr MarshalManagedToNative (object managedObj) - { - if (managedObj == null) - return IntPtr.Zero; - - ICppObject cppObject = managedObj as ICppObject; - if (cppObject == null) - throw new ArgumentException ("Object to marshal must implement ICppObject"); - - return (IntPtr)cppObject.Native; - } - - public object MarshalNativeToManaged (IntPtr pNativeData) - { - throw new NotImplementedException (); - } - - public void CleanUpManagedData (object ManagedObj) - { - } - - public void CleanUpNativeData (IntPtr pNativeData) - { - } - - public int GetNativeDataSize () - { - return -1; - } - - public static ICustomMarshaler GetInstance(string cookie) - { - if(marshaler == null) - marshaler = new CppObjectMarshaler (); - return marshaler; - } - - } -} - diff --git a/src/Mono.Cxxi/Makefile.am b/src/Mono.Cxxi/Makefile.am index 191bbfd2..745859bf 100644 --- a/src/Mono.Cxxi/Makefile.am +++ b/src/Mono.Cxxi/Makefile.am @@ -48,7 +48,6 @@ FILES = \ Abi/Impl/ItaniumAbi.cs \ Abi/Impl/ItaniumTypeInfo.cs \ Abi/Impl/MsvcAbi.cs \ - Abi/Impl/VirtualOnlyAbi.cs \ Abi/MethodType.cs \ Abi/VTable.cs \ AssemblyInfo.cs \ @@ -57,7 +56,6 @@ FILES = \ CppInstancePtr.cs \ CppLibrary.cs \ CppModifiers.cs \ - CppObjectMarshaler.cs \ CppType.cs \ CppTypeInfo.cs \ Interfaces.cs \ diff --git a/src/Mono.Cxxi/Mono.Cxxi.csproj b/src/Mono.Cxxi/Mono.Cxxi.csproj index bc1c9725..721c3f87 100644 --- a/src/Mono.Cxxi/Mono.Cxxi.csproj +++ b/src/Mono.Cxxi/Mono.Cxxi.csproj @@ -67,9 +67,7 @@ - -