Example #1
0
        private static long Convert(IntPtr __envp, JniLocalHandle __class, JniLocalHandle str)
        {
            JNIEnv env = JNIEnv.Wrap(__envp);

            try
            {
                string value = env.ConvertToString(str);
                return(IntHandle.Alloc(value));
            }
            catch (Exception ex)
            {
                env.ThrowExisting(ex);
            }
            return(default(long));
        }
Example #2
0
        private static long WrapJVM(IntPtr __envp, JniLocalHandle __class, JniLocalHandle obj)
        {
            JNIEnv env = JNIEnv.Wrap(__envp);

            try
            {
                Class          clazz    = env.GetObjectClass(obj);
                RegistryRecord record   = Registry.GetJVMRecord(clazz);
                IJvmProxy      clrProxy = record.CreateCLRProxy(env, obj);
                return(IntHandle.Alloc(clrProxy));
            }
            catch (Exception ex)
            {
                env.ThrowExisting(ex);
            }
            return(0);
        }