示例#1
0
        public JNIResult GetEnv(out JNIEnv penv, int version)
        {
            if (getEnv == null)
            {
                MethodWrapper.GetDelegateForFunctionPointer(functions.GetEnv, ref getEnv);
            }
            IntPtr    env;
            JNIResult result = getEnv.Invoke(native, out env, version);

            penv = new JNIEnv(env);
            return(result);
        }
示例#2
0
        public JNIResult AttachCurrentThread(out JNIEnv penv, JavaVMInitArgs?args)
        {
            if (attachCurrentThread == null)
            {
                MethodWrapper.GetDelegateForFunctionPointer(functions.AttachCurrentThread, ref attachCurrentThread);
            }
            IntPtr    env;
            JNIResult result;

            if (args.HasValue)
            {
                JavaVMInitArgs initArgs = args.Value;
                result = attachCurrentThread.Invoke(native, out env, &initArgs);
            }
            else
            {
                result = attachCurrentThread.Invoke(native, out env, null);
            }
            penv = new JNIEnv(env);
            return(result);
        }