1 /* GMODULE - GLIB wrapper code for dynamic module loading
2 * Copyright (C) 1998 Tim Janik
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 /* some flags are missing on some systems, so we provide
26 #define DYNAMIC_PATH 0
27 #endif /* DYNAMIC_PATH */
29 /* should we have BIND_TOGETHER here as well? */
30 #define CONST_BIND_FLAGS (BIND_NONFATAL | BIND_VERBOSE)
33 /* --- functions --- */
35 _g_module_open (const gchar *file_name,
40 handle = shl_load (file_name, CONST_BIND_FLAGS | (bind_lazy ? BIND_DEFERRED : BIND_IMMEDIATE), 0);
42 g_module_set_error (g_strerror (errno));
54 g_module_set_error (g_strerror (errno));
60 _g_module_close (gpointer *handle_p,
65 if (shl_unload (*handle_p) != 0)
66 g_module_set_error (g_strerror (errno));
71 _g_module_symbol (gpointer *handle_p,
72 const gchar *symbol_name)
76 /* should we restrict lookups to TYPE_PROCEDURE?
78 if (shl_findsym (handle_p, symbol_name, TYPE_UNDEFINED, &p) != 0 || p == NULL)
79 g_module_set_error (g_strerror (errno));