Exemple #1
0
        public static objc_method FromMethodInfo(MethodInfo method)
        {
            objc_method objc_method = new objc_method ();
            string name = SelectorFromMethodInfo (method);
            string types = SignatureFromMethodInfo (method);

            foreach (ExportAttribute exattr in Attribute.GetCustomAttributes (method, typeof (ExportAttribute))) {
                name = exattr.Selector == null ? name : exattr.Selector;
                types = exattr.Signature == null ? types : exattr.Signature;
            }

            objc_method.name = Marshal.StringToHGlobalAnsi (name);
            objc_method.types = Marshal.StringToHGlobalAnsi (types);
            MethodInfo method_proxy = BuildMethodProxy (method);
            objc_method.imp = Delegate.CreateDelegate (MethodImplementation.FromMethodInfo (method_proxy), method_proxy);

            return objc_method;
        }
Exemple #2
0
        public static objc_method FromConstructorInfo(ConstructorInfo constructor)
        {
            objc_method objc_method = new objc_method ();
            string name = SelectorFromConstructorInfo (constructor);
            string types = SignatureFromConstructorInfo (constructor);

            foreach (ExportAttribute exattr in Attribute.GetCustomAttributes (constructor, typeof (ExportAttribute))) {
                name = exattr.Selector == null ? name : exattr.Selector;
                types = exattr.Signature == null ? types : exattr.Signature;
            }

            objc_method.name = Marshal.StringToHGlobalAnsi (name);
            objc_method.types = Marshal.StringToHGlobalAnsi (types);
            // FIXME
            ConstructorInfo constructor_proxy = BuildConstructorProxy (constructor);
            objc_method.imp = Delegate.CreateDelegate (MethodImplementation.FromConstructorInfo (constructor_proxy), null);

            return objc_method;
        }
        public static objc_method FromMethodInfo(MethodInfo method)
        {
            objc_method objc_method = new objc_method();
            string      name        = SelectorFromMethodInfo(method);
            string      types       = SignatureFromMethodInfo(method);

            foreach (ExportAttribute exattr in Attribute.GetCustomAttributes(method, typeof(ExportAttribute)))
            {
                name  = exattr.Selector == null ? name : exattr.Selector;
                types = exattr.Signature == null ? types : exattr.Signature;
            }

            objc_method.name  = Marshal.StringToHGlobalAnsi(name);
            objc_method.types = Marshal.StringToHGlobalAnsi(types);
            MethodInfo method_proxy = BuildMethodProxy(method);

            objc_method.imp = Delegate.CreateDelegate(MethodImplementation.FromMethodInfo(method_proxy), method_proxy);

            return(objc_method);
        }
        public static objc_method FromConstructorInfo(ConstructorInfo constructor)
        {
            objc_method objc_method = new objc_method();
            string      name        = SelectorFromConstructorInfo(constructor);
            string      types       = SignatureFromConstructorInfo(constructor);

            foreach (ExportAttribute exattr in Attribute.GetCustomAttributes(constructor, typeof(ExportAttribute)))
            {
                name  = exattr.Selector == null ? name : exattr.Selector;
                types = exattr.Signature == null ? types : exattr.Signature;
            }

            objc_method.name  = Marshal.StringToHGlobalAnsi(name);
            objc_method.types = Marshal.StringToHGlobalAnsi(types);
            // FIXME
            ConstructorInfo constructor_proxy = BuildConstructorProxy(constructor);

            objc_method.imp = Delegate.CreateDelegate(MethodImplementation.FromConstructorInfo(constructor_proxy), null);

            return(objc_method);
        }