/* dynl-dl.c - dynamic linking for dlopen/dlsym
*
- * Copyright (C) 1990-1997 Free Software Foundation, Inc.
+ * Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#endif
static void *
-sysdep_dynl_link (fname, subr)
- char *fname;
- char *subr;
+sysdep_dynl_link (fname, flags, subr)
+ const char *fname;
+ int flags;
+ const char *subr;
{
- void *handle = dlopen (fname, DLOPEN_MODE);
+ void *handle = dlopen (fname, (DLOPEN_MODE
+ | ((flags & DYNL_GLOBAL)? RTLD_GLOBAL : 0)));
if (NULL == handle)
{
SCM_ALLOW_INTS;
static void
sysdep_dynl_unlink (handle, subr)
void *handle;
- char *subr;
+ const char *subr;
{
if (dlclose (handle))
{
static void *
sysdep_dynl_func (symb, handle, subr)
- char *symb;
+ const char *symb;
void *handle;
- char *subr;
+ const char *subr;
{
void *fptr;
char *err;
+#if defined(USCORE) && !defined(DLSYM_ADDS_USCORE)
+ char *usymb;
+#endif
+#if defined(USCORE) && !defined(DLSYM_ADDS_USCORE)
+ usymb = (char *) malloc (strlen (symb) + 2);
+ *usymb = '_';
+ strcpy (usymb + 1, symb);
+ fptr = dlsym (handle, usymb);
+ free (usymb);
+#else
fptr = dlsym (handle, symb);
+#endif
+
err = (char *)dlerror ();
if (!fptr)
{