< prev index next >

src/java.base/share/native/libjava/jni_util.h

Print this page


   1 /*
   2  * Copyright (c) 1997, 2016, 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


 378  * Internal use only.
 379  */
 380 enum {
 381     NO_ENCODING_YET = 0,        /* "sun.jnu.encoding" not yet set */
 382     NO_FAST_ENCODING,           /* Platform encoding is not fast */
 383     FAST_8859_1,                /* ISO-8859-1 */
 384     FAST_CP1252,                /* MS-DOS Cp1252 */
 385     FAST_646_US,                /* US-ASCII : ISO646-US */
 386     FAST_UTF_8
 387 };
 388 
 389 int getFastEncoding();
 390 
 391 void InitializeEncoding(JNIEnv *env, const char *name);
 392 
 393 void* getProcessHandle();
 394 
 395 void buildJniFunctionName(const char *sym, const char *cname,
 396                           char *jniEntryName);
 397 
 398 extern size_t getLastErrorString(char *buf, size_t len);
 399 extern int getErrorString(int err, char *buf, size_t len);



 400 
 401 #ifdef STATIC_BUILD
 402 /* Macros for handling declaration of static/dynamic
 403  * JNI library Load/Unload functions
 404  *
 405  * Use DEF_JNI_On{Un}Load when you want a static and non-static entry points.
 406  * Use DEF_STATIC_JNI_On{Un}Load when you only want a static one.
 407  *
 408  * LIBRARY_NAME must be set to the name of the library
 409  */
 410 
 411 /* These three macros are needed to get proper concatenation of
 412  * the LIBRARY_NAME
 413  *
 414  * NOTE: LIBRARY_NAME must be set for static builds.
 415  */
 416 #define ADD_LIB_NAME3(name, lib) name ## lib
 417 #define ADD_LIB_NAME2(name, lib) ADD_LIB_NAME3(name, lib)
 418 #define ADD_LIB_NAME(entry) ADD_LIB_NAME2(entry, LIBRARY_NAME)
 419 


   1 /*
   2  * Copyright (c) 1997, 2018, 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


 378  * Internal use only.
 379  */
 380 enum {
 381     NO_ENCODING_YET = 0,        /* "sun.jnu.encoding" not yet set */
 382     NO_FAST_ENCODING,           /* Platform encoding is not fast */
 383     FAST_8859_1,                /* ISO-8859-1 */
 384     FAST_CP1252,                /* MS-DOS Cp1252 */
 385     FAST_646_US,                /* US-ASCII : ISO646-US */
 386     FAST_UTF_8
 387 };
 388 
 389 int getFastEncoding();
 390 
 391 void InitializeEncoding(JNIEnv *env, const char *name);
 392 
 393 void* getProcessHandle();
 394 
 395 void buildJniFunctionName(const char *sym, const char *cname,
 396                           char *jniEntryName);
 397 
 398 JNIEXPORT size_t JNICALL
 399 getLastErrorString(char *buf, size_t len);
 400 
 401 JNIEXPORT int JNICALL
 402 getErrorString(int err, char *buf, size_t len);
 403 
 404 #ifdef STATIC_BUILD
 405 /* Macros for handling declaration of static/dynamic
 406  * JNI library Load/Unload functions
 407  *
 408  * Use DEF_JNI_On{Un}Load when you want a static and non-static entry points.
 409  * Use DEF_STATIC_JNI_On{Un}Load when you only want a static one.
 410  *
 411  * LIBRARY_NAME must be set to the name of the library
 412  */
 413 
 414 /* These three macros are needed to get proper concatenation of
 415  * the LIBRARY_NAME
 416  *
 417  * NOTE: LIBRARY_NAME must be set for static builds.
 418  */
 419 #define ADD_LIB_NAME3(name, lib) name ## lib
 420 #define ADD_LIB_NAME2(name, lib) ADD_LIB_NAME3(name, lib)
 421 #define ADD_LIB_NAME(entry) ADD_LIB_NAME2(entry, LIBRARY_NAME)
 422 


< prev index next >