< prev index next >

src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c

Print this page
rev 12879 : 8136556: Add the ability to perform static builds of MacOSX x64 binaries
Reviewed-by: ihse, bdelsart, gadams, lfoltan, rriggs, hseigel, twisti
   1 /*
   2  * Copyright (c) 2000, 2014, 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


 161 
 162     if (fmProp) {
 163         (*env)->DeleteLocalRef(env, fmProp);
 164     }
 165     if (fmanager) {
 166         (*env)->DeleteLocalRef(env, fmanager);
 167     }
 168 
 169     jstring jbuf = JNU_NewStringPlatform(env, buf);
 170     CHECK_EXCEPTION_FATAL(env, "Could not allocate library name");
 171     JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
 172                                "(Ljava/lang/String;)V",
 173                                jbuf);
 174 
 175     awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
 176 
 177     return JNI_VERSION_1_2;
 178 }
 179 
 180 JNIEXPORT jint JNICALL
 181 JNI_OnLoad(JavaVM *vm, void *reserved)
 182 {
 183     return AWT_OnLoad(vm, reserved);
 184 }
 185 
 186 /*
 187  * This entry point must remain in libawt.so as part of a contract
 188  * with the CDE variant of Java Media Framework. (sdtjmplay)
 189  * Reflect this call over to the correct libawt_<toolkit>.so.
 190  */
 191 JNIEXPORT void JNICALL
 192 Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this,
 193                                      jobject frame, jstring jcommand)
 194 {
 195     /* type of the old backdoor function */
 196     typedef void JNICALL
 197         XsessionWMcommand_type(JNIEnv *env, jobject this,
 198                                jobject frame, jstring jcommand);
 199 
 200     static XsessionWMcommand_type *XsessionWMcommand = NULL;
 201 


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


 161 
 162     if (fmProp) {
 163         (*env)->DeleteLocalRef(env, fmProp);
 164     }
 165     if (fmanager) {
 166         (*env)->DeleteLocalRef(env, fmanager);
 167     }
 168 
 169     jstring jbuf = JNU_NewStringPlatform(env, buf);
 170     CHECK_EXCEPTION_FATAL(env, "Could not allocate library name");
 171     JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
 172                                "(Ljava/lang/String;)V",
 173                                jbuf);
 174 
 175     awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
 176 
 177     return JNI_VERSION_1_2;
 178 }
 179 
 180 JNIEXPORT jint JNICALL
 181 DEF_JNI_OnLoad(JavaVM *vm, void *reserved)
 182 {
 183     return AWT_OnLoad(vm, reserved);
 184 }
 185 
 186 /*
 187  * This entry point must remain in libawt.so as part of a contract
 188  * with the CDE variant of Java Media Framework. (sdtjmplay)
 189  * Reflect this call over to the correct libawt_<toolkit>.so.
 190  */
 191 JNIEXPORT void JNICALL
 192 Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this,
 193                                      jobject frame, jstring jcommand)
 194 {
 195     /* type of the old backdoor function */
 196     typedef void JNICALL
 197         XsessionWMcommand_type(JNIEnv *env, jobject this,
 198                                jobject frame, jstring jcommand);
 199 
 200     static XsessionWMcommand_type *XsessionWMcommand = NULL;
 201 


< prev index next >