📄 jni_pas.html
字号:
<html>
<body bgcolor=#e0e0e0><pre class="sourcecode"><code>
<font color="#003399"><i>{******************************************************************}</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ Borland Delphi Runtime Library }</i></font>
<font color="#003399"><i>{ Java Native Interface Unit }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ Portions created by Sun are }</i></font>
<font color="#003399"><i>{ Copyright (C) 1996-1999 Sun Microsystems, Inc., }</i></font>
<font color="#003399"><i>{ 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. }</i></font>
<font color="#003399"><i>{ All Rights Reserved. }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ The original file is: jni.h, released 22 Apr 1999. }</i></font>
<font color="#003399"><i>{ The original Pascal code is: jni.pas, released 01 Sep 2000. }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ Portions created by Matthew Mead are }</i></font>
<font color="#003399"><i>{ Copyright (C) 2001 MMG and Associates }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ Obtained through: }</i></font>
<font color="#003399"><i>{ Joint Endeavour of Delphi Innovators (Project JEDI) }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ You may retrieve the latest version of this file at the Project }</i></font>
<font color="#003399"><i>{ JEDI home page, located at http://delphi-jedi.org }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ The contents of this file are used with permission, subject to }</i></font>
<font color="#003399"><i>{ the Mozilla Public License Version 1.1 (the "License"); you may }</i></font>
<font color="#003399"><i>{ not use this file except in compliance with the License. You may }</i></font>
<font color="#003399"><i>{ obtain a copy of the License at }</i></font>
<font color="#003399"><i>{ http://www.mozilla.org/NPL/NPL-1_1Final.html }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ Software distributed under the License is distributed on an }</i></font>
<font color="#003399"><i>{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or }</i></font>
<font color="#003399"><i>{ implied. See the License for the specific language governing }</i></font>
<font color="#003399"><i>{ rights and limitations under the License. }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{ History: }</i></font>
<font color="#003399"><i>{ 03 Dec 2000 - Fixed parameters for DestroyJavaVM, GetEnv, }</i></font>
<font color="#003399"><i>{ AttachCurrentThread, and DetachCurrentThread }</i></font>
<font color="#003399"><i>{ 02 Jan 2001 - Fix in TJNIEnv.ArgsToJValues. Cast AnsiString }</i></font>
<font color="#003399"><i>{ to JString. }</i></font>
<font color="#003399"><i>{ }</i></font>
<font color="#003399"><i>{******************************************************************}</i></font>
<b>unit</b> JNI;
<b>interface</b>
<b>uses</b>
Windows,
Sysutils;
<font color="#003399"><i>{ Note:
It is possible to include the defintions from JNI_MD.INC directly
in this file. However, the idea behind separating platform-specific
definitions is to keep this file as generic as possible. Some time
ago, this would not have been important, since Delphi *was* a
Windows-only tool. Now, with Kylix approaching, it will be important
to keep the platform-specific types separate.
}</i></font>
<font color="#003399"><i>// JNI_MD.INC contains the machine-dependent typedefs for JByte, JInt and JLong</i></font>
<font color="#003399"><i>{$INCLUDE JNI_MD.INC}</i></font>
<b>const</b>
JNI_VERSION_1_1 = JInt($00010001);
<font color="#003399"><i>{$EXTERNALSYM JNI_VERSION_1_1}</i></font>
JNI_VERSION_1_2 = JInt($00010002);
<font color="#003399"><i>{$EXTERNALSYM JNI_VERSION_1_2}</i></font>
<font color="#003399"><i>// JBoolean constants</i></font>
JNI_TRUE = True;
<font color="#003399"><i>{$EXTERNALSYM JNI_TRUE}</i></font>
JNI_FALSE = False;
<font color="#003399"><i>{$EXTERNALSYM JNI_FALSE}</i></font>
<font color="#003399"><i>// possible return values for JNI functions.</i></font>
JNI_OK = 0; <font color="#003399"><i>// success</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_OK}</i></font>
JNI_ERR = -1; <font color="#003399"><i>// unknown error</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_ERR}</i></font>
JNI_EDETACHED = -2; <font color="#003399"><i>// thread detached from the VM</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_EDETACHED}</i></font>
JNI_EVERSION = -3; <font color="#003399"><i>// JNI version error</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_EVERSION}</i></font>
JNI_ENOMEM = -4; <font color="#003399"><i>// not enough memory</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_ENOMEM}</i></font>
JNI_EEXIST = -5; <font color="#003399"><i>// VM already created</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_EEXIST}</i></font>
JNI_EINVAL = -6; <font color="#003399"><i>// invalid arguments</i></font>
<font color="#003399"><i>{$EXTERNALSYM JNI_EINVAL}</i></font>
JNI_ENOJAVA = -101; <font color="#003399"><i>// local error for not finding the DLL</i></font>
<font color="#003399"><i>// used in ReleaseScalarArrayElements</i></font>
JNI_COMMIT = 1;
<font color="#003399"><i>{$EXTERNALSYM JNI_COMMIT}</i></font>
JNI_ABORT = 2;
<font color="#003399"><i>{$EXTERNALSYM JNI_ABORT}</i></font>
<b>type</b>
<font color="#003399"><i>// JNI Types</i></font>
JBoolean = Boolean;
JChar = WideChar;
JShort = Smallint;
JFloat = Single;
JDouble = Double;
JSize = JInt;
_JObject = <b>record</b>
<b>end</b>;
JObject = ^_JObject;
JClass = JObject;
JThrowable = JObject;
JString = JObject;
JArray = JObject;
JBooleanArray = JArray;
JByteArray = JArray;
JCharArray = JArray;
JShortArray = JArray;
JIntArray = JArray;
JLongArray = JArray;
JFloatArray = JArray;
JDoubleArray = JArray;
JObjectArray = JArray;
JWeak = JObject;
JRef = JObject;
JValue = <b>packed</b> <b>record</b>
<b>case</b> Integer <b>of</b>
0: (z: JBoolean);
1: (b: JByte );
2: (c: JChar );
3: (s: JShort );
4: (i: JInt );
5: (j: JLong );
6: (f: JFloat );
7: (d: JDouble );
8: (l: JObject );
<b>end</b>;
JFieldID = ^_JFieldID;
_JFieldID = <b>record</b>
<b>end</b>;
JMethodID = ^_JMethodID;
_JMethodID = <b>record</b>
<b>end</b>;
PPointer = ^Pointer;
PJByte = ^JByte;
PJBoolean = ^JBoolean;
PJChar = ^JChar;
PJShort = ^JShort;
PJInt = ^JInt;
PJLong = ^JLong;
PJFloat = ^JFloat;
PJDouble = ^JDouble;
PJString = ^JString;
PJSize = ^JSize;
PJClass = ^JClass;
PJObject = ^JObject;
PJThrowable = ^JThrowable;
PJArray = ^JArray;
PJByteArray = ^JByteArray;
PJBooleanArray = ^JBooleanArray;
PJCharArray = ^JCharArray;
PJShortArray = ^JShortArray;
PJIntArray = ^JIntArray;
PJLongArray = ^JLongArray;
PJFloatArray = ^JFloatArray;
PJDoubleArray = ^JDoubleArray;
PJObjectArray = ^JObjectArray;
PJFieldID = ^JFieldID;
PJMethodID = ^JMethodID;
PJValue = ^JValue;
PJWeak = ^JWeak;
PJRef = ^JRef;
<font color="#003399"><i>// used in RegisterNatives to describe native method name, signature,</i></font>
<font color="#003399"><i>// and function pointer.</i></font>
PJNINativeMethod = ^JNINativeMethod;
JNINativeMethod = <b>packed</b> <b>record</b>
name: PAnsiChar;
signature: PAnsiChar;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -