< prev index next >

src/java.base/share/native/include/jni.h

Print this page

   1 /*
   2  * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any

 766     /* New JNI 1.6 Features */
 767 
 768     jobjectRefType (JNICALL *GetObjectRefType)
 769         (JNIEnv* env, jobject obj);
 770 
 771     /* Module Features */
 772 
 773     jobject (JNICALL *GetModule)
 774        (JNIEnv* env, jclass clazz);
 775 
 776     /* Virtual threads */
 777 
 778     jboolean (JNICALL *IsVirtualThread)
 779        (JNIEnv* env, jobject obj);
 780 
 781     /* Large UTF8 Support */
 782 
 783     jlong (JNICALL *GetStringUTFLengthAsLong)
 784       (JNIEnv *env, jstring str);
 785 





 786 };
 787 
 788 /*
 789  * We use inlined functions for C++ so that programmers can write:
 790  *
 791  *    env->FindClass("java/lang/String")
 792  *
 793  * in C++ rather than:
 794  *
 795  *    (*env)->FindClass(env, "java/lang/String")
 796  *
 797  * in C.
 798  */
 799 
 800 struct JNIEnv_ {
 801     const struct JNINativeInterface_ *functions;
 802 #ifdef __cplusplus
 803 
 804     jint GetVersion() {
 805         return functions->GetVersion(this);

1873     }
1874     jlong GetDirectBufferCapacity(jobject buf) {
1875         return functions->GetDirectBufferCapacity(this, buf);
1876     }
1877     jobjectRefType GetObjectRefType(jobject obj) {
1878         return functions->GetObjectRefType(this, obj);
1879     }
1880 
1881     /* Module Features */
1882 
1883     jobject GetModule(jclass clazz) {
1884         return functions->GetModule(this, clazz);
1885     }
1886 
1887     /* Virtual threads */
1888 
1889     jboolean IsVirtualThread(jobject obj) {
1890         return functions->IsVirtualThread(this, obj);
1891     }
1892 






1893 #endif /* __cplusplus */
1894 };
1895 
1896 /*
1897  * optionString may be any option accepted by the JVM, or one of the
1898  * following:
1899  *
1900  * -D<name>=<value>          Set a system property.
1901  * -verbose[:class|gc|jni]   Enable verbose output, comma-separated. E.g.
1902  *                           "-verbose:class" or "-verbose:gc,class"
1903  *                           Standard names include: gc, class, and jni.
1904  *                           All nonstandard (VM-specific) names must begin
1905  *                           with "X".
1906  * vfprintf                  extraInfo is a pointer to the vfprintf hook.
1907  * exit                      extraInfo is a pointer to the exit hook.
1908  * abort                     extraInfo is a pointer to the abort hook.
1909  */
1910 typedef struct JavaVMOption {
1911     char *optionString;
1912     void *extraInfo;

1988 JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
1989 
1990 /* Defined by native libraries. */
1991 JNIEXPORT jint JNICALL
1992 JNI_OnLoad(JavaVM *vm, void *reserved);
1993 
1994 JNIEXPORT void JNICALL
1995 JNI_OnUnload(JavaVM *vm, void *reserved);
1996 
1997 #define JNI_VERSION_1_1 0x00010001
1998 #define JNI_VERSION_1_2 0x00010002
1999 #define JNI_VERSION_1_4 0x00010004
2000 #define JNI_VERSION_1_6 0x00010006
2001 #define JNI_VERSION_1_8 0x00010008
2002 #define JNI_VERSION_9   0x00090000
2003 #define JNI_VERSION_10  0x000a0000
2004 #define JNI_VERSION_19  0x00130000
2005 #define JNI_VERSION_20  0x00140000
2006 #define JNI_VERSION_21  0x00150000
2007 #define JNI_VERSION_24  0x00180000

2008 
2009 #ifdef __cplusplus
2010 } /* extern "C" */
2011 #endif /* __cplusplus */
2012 
2013 #endif /* !_JAVASOFT_JNI_H_ */

   1 /*
   2  * Copyright (c) 1996, 2026, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any

 766     /* New JNI 1.6 Features */
 767 
 768     jobjectRefType (JNICALL *GetObjectRefType)
 769         (JNIEnv* env, jobject obj);
 770 
 771     /* Module Features */
 772 
 773     jobject (JNICALL *GetModule)
 774        (JNIEnv* env, jclass clazz);
 775 
 776     /* Virtual threads */
 777 
 778     jboolean (JNICALL *IsVirtualThread)
 779        (JNIEnv* env, jobject obj);
 780 
 781     /* Large UTF8 Support */
 782 
 783     jlong (JNICALL *GetStringUTFLengthAsLong)
 784       (JNIEnv *env, jstring str);
 785 
 786     /* Value classes */
 787 
 788     jboolean (JNICALL *HasIdentity)
 789       (JNIEnv* env, jobject obj);
 790 
 791 };
 792 
 793 /*
 794  * We use inlined functions for C++ so that programmers can write:
 795  *
 796  *    env->FindClass("java/lang/String")
 797  *
 798  * in C++ rather than:
 799  *
 800  *    (*env)->FindClass(env, "java/lang/String")
 801  *
 802  * in C.
 803  */
 804 
 805 struct JNIEnv_ {
 806     const struct JNINativeInterface_ *functions;
 807 #ifdef __cplusplus
 808 
 809     jint GetVersion() {
 810         return functions->GetVersion(this);

1878     }
1879     jlong GetDirectBufferCapacity(jobject buf) {
1880         return functions->GetDirectBufferCapacity(this, buf);
1881     }
1882     jobjectRefType GetObjectRefType(jobject obj) {
1883         return functions->GetObjectRefType(this, obj);
1884     }
1885 
1886     /* Module Features */
1887 
1888     jobject GetModule(jclass clazz) {
1889         return functions->GetModule(this, clazz);
1890     }
1891 
1892     /* Virtual threads */
1893 
1894     jboolean IsVirtualThread(jobject obj) {
1895         return functions->IsVirtualThread(this, obj);
1896     }
1897 
1898     /* Value classes */
1899 
1900     jboolean HasIdentity(jobject obj) {
1901         return functions->HasIdentity(this, obj);
1902     }
1903 
1904 #endif /* __cplusplus */
1905 };
1906 
1907 /*
1908  * optionString may be any option accepted by the JVM, or one of the
1909  * following:
1910  *
1911  * -D<name>=<value>          Set a system property.
1912  * -verbose[:class|gc|jni]   Enable verbose output, comma-separated. E.g.
1913  *                           "-verbose:class" or "-verbose:gc,class"
1914  *                           Standard names include: gc, class, and jni.
1915  *                           All nonstandard (VM-specific) names must begin
1916  *                           with "X".
1917  * vfprintf                  extraInfo is a pointer to the vfprintf hook.
1918  * exit                      extraInfo is a pointer to the exit hook.
1919  * abort                     extraInfo is a pointer to the abort hook.
1920  */
1921 typedef struct JavaVMOption {
1922     char *optionString;
1923     void *extraInfo;

1999 JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
2000 
2001 /* Defined by native libraries. */
2002 JNIEXPORT jint JNICALL
2003 JNI_OnLoad(JavaVM *vm, void *reserved);
2004 
2005 JNIEXPORT void JNICALL
2006 JNI_OnUnload(JavaVM *vm, void *reserved);
2007 
2008 #define JNI_VERSION_1_1 0x00010001
2009 #define JNI_VERSION_1_2 0x00010002
2010 #define JNI_VERSION_1_4 0x00010004
2011 #define JNI_VERSION_1_6 0x00010006
2012 #define JNI_VERSION_1_8 0x00010008
2013 #define JNI_VERSION_9   0x00090000
2014 #define JNI_VERSION_10  0x000a0000
2015 #define JNI_VERSION_19  0x00130000
2016 #define JNI_VERSION_20  0x00140000
2017 #define JNI_VERSION_21  0x00150000
2018 #define JNI_VERSION_24  0x00180000
2019 #define JNI_VERSION_28  0x001C0000
2020 
2021 #ifdef __cplusplus
2022 } /* extern "C" */
2023 #endif /* __cplusplus */
2024 
2025 #endif /* !_JAVASOFT_JNI_H_ */
< prev index next >