Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/xawt/gnome_interface.c
32287 views
/*1* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include "gnome_interface.h"2627GNOME_URL_SHOW_TYPE *gnome_url_show = NULL;2829gboolean gnome_load() {30void *vfs_handle;31void *gnome_handle;32const char *errmsg;33GNOME_VFS_INIT_TYPE *gnome_vfs_init;3435// trying to open the gnomevfs. VERSIONED_JNI_LIB_NAME36// macros formats the library name in a system specific manner37// see jdk/src/solaris/javavm/export/jvm_md.h for more details38vfs_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnomevfs-2", "0"), RTLD_LAZY);39if (vfs_handle == NULL) {40// if we cannot load the library using a version assumed by JNI41// we are trying to load the library without a version suffix42vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);43if (vfs_handle == NULL) {44#ifdef INTERNAL_BUILD45fprintf(stderr, "can not load libgnomevfs-2.so\n");46#endif47return FALSE;48}49}50dlerror(); /* Clear errors */51gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");52if (gnome_vfs_init == NULL){53#ifdef INTERNAL_BUILD54fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");55#endif56return FALSE;57}58if ((errmsg = dlerror()) != NULL) {59#ifdef INTERNAL_BUILD60fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);61#endif62return FALSE;63}64// call gonme_vfs_init()65(*gnome_vfs_init)();6667gnome_handle = dlopen(VERSIONED_JNI_LIB_NAME("gnome-2", "0"), RTLD_LAZY);68if (gnome_handle == NULL) {69gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);70if (gnome_handle == NULL) {71#ifdef INTERNAL_BUILD72fprintf(stderr, "can not load libgnome-2.so\n");73#endif74return FALSE;75}76}77dlerror(); /* Clear errors */78gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");79if ((errmsg = dlerror()) != NULL) {80#ifdef INTERNAL_BUILD81fprintf(stderr, "can not find symble gnome_url_show\n");82#endif83return FALSE;84}85return TRUE;86}878889