1996-12-08 16:52:38 +00:00
|
|
|
/* dynl.c - dynamic linking
|
|
|
|
|
*
|
2003-11-08 22:18:33 +00:00
|
|
|
* Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
|
|
|
|
|
* 2003 Free Software Foundation, Inc.
|
1996-12-08 16:52:38 +00:00
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
1996-12-08 16:52:38 +00:00
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
1996-12-08 16:52:38 +00:00
|
|
|
*
|
2003-04-05 19:15:35 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
1996-12-08 16:52:38 +00:00
|
|
|
|
1999-12-12 02:36:16 +00:00
|
|
|
|
|
|
|
|
|
1996-12-08 16:52:38 +00:00
|
|
|
/* "dynl.c" dynamically link&load object files.
|
|
|
|
|
Author: Aubrey Jaffer
|
|
|
|
|
Modified for libguile by Marius Vollmer */
|
|
|
|
|
|
1998-05-02 22:26:44 +00:00
|
|
|
#if 0 /* Disabled until we know for sure that it isn't needed */
|
1997-01-18 11:40:31 +00:00
|
|
|
/* XXX - This is only here to drag in a definition of __eprintf. This
|
|
|
|
|
is needed for proper operation of dynamic linking. The real
|
|
|
|
|
solution would probably be a shared libgcc. */
|
|
|
|
|
|
|
|
|
|
#undef NDEBUG
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
maybe_drag_in_eprintf ()
|
|
|
|
|
{
|
|
|
|
|
assert (!maybe_drag_in_eprintf);
|
|
|
|
|
}
|
1998-05-02 22:26:44 +00:00
|
|
|
#endif
|
1997-01-18 11:40:31 +00:00
|
|
|
|
1997-01-20 19:11:41 +00:00
|
|
|
#include <stdio.h>
|
2001-01-26 17:30:54 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
2000-04-21 14:16:44 +00:00
|
|
|
#include "libguile/_scm.h"
|
|
|
|
|
#include "libguile/dynl.h"
|
|
|
|
|
#include "libguile/smob.h"
|
|
|
|
|
#include "libguile/keywords.h"
|
|
|
|
|
#include "libguile/ports.h"
|
|
|
|
|
#include "libguile/strings.h"
|
2001-06-03 23:31:14 +00:00
|
|
|
#include "libguile/deprecation.h"
|
2002-01-22 23:31:39 +00:00
|
|
|
#include "libguile/lang.h"
|
2000-04-21 14:16:44 +00:00
|
|
|
#include "libguile/validate.h"
|
1999-12-18 23:33:15 +00:00
|
|
|
|
2002-10-05 04:55:22 +00:00
|
|
|
#include "guile-ltdl.h"
|
2000-01-10 00:36:26 +00:00
|
|
|
|
2002-08-04 14:09:14 +00:00
|
|
|
/*
|
|
|
|
|
From the libtool manual: "Note that libltdl is not threadsafe,
|
|
|
|
|
i.e. a multithreaded application has to use a mutex for libltdl.".
|
|
|
|
|
|
|
|
|
|
Guile does not currently support pre-emptive threads, so there is
|
|
|
|
|
no mutex. Previously SCM_DEFER_INTS and SCM_ALLOW_INTS were used:
|
|
|
|
|
they are mentioned here in case somebody is grepping for thread
|
|
|
|
|
problems ;)
|
2002-06-30 20:34:38 +00:00
|
|
|
*/
|
|
|
|
|
|
2000-01-10 00:36:26 +00:00
|
|
|
static void *
|
2000-05-18 08:47:52 +00:00
|
|
|
sysdep_dynl_link (const char *fname, const char *subr)
|
2000-01-10 00:36:26 +00:00
|
|
|
{
|
2002-10-05 04:55:22 +00:00
|
|
|
scm_lt_dlhandle handle;
|
2002-10-03 22:44:48 +00:00
|
|
|
handle = scm_lt_dlopenext (fname);
|
2000-01-10 00:36:26 +00:00
|
|
|
if (NULL == handle)
|
|
|
|
|
{
|
2000-12-05 03:04:20 +00:00
|
|
|
SCM fn;
|
|
|
|
|
SCM msg;
|
|
|
|
|
|
|
|
|
|
fn = scm_makfrom0str (fname);
|
2002-10-03 22:44:48 +00:00
|
|
|
msg = scm_makfrom0str (scm_lt_dlerror ());
|
* list.h (scm_list_1, scm_list_2, scm_list_3, scm_list_4, scm_list_5,
scm_list_n): New functions.
(SCM_LIST0, SCM_LIST1, SCM_LIST2, SCM_LIST3, SCM_LIST4, SCM_LIST5,
SCM_LIST6, SCM_LIST7, SCM_LIST8, SCM_LIST9, scm_listify): Deprecated.
(lots of files): Use the new functions.
* goops.c (CALL_GF1, CALL_GF2, CALL_GF3, CALL_GF4): Use scm_call_N.
* strings.c: #include "libguile/deprecation.h".
2001-06-28 01:11:59 +00:00
|
|
|
scm_misc_error (subr, "file: ~S, message: ~S", scm_list_2 (fn, msg));
|
2000-01-10 00:36:26 +00:00
|
|
|
}
|
|
|
|
|
return (void *) handle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sysdep_dynl_unlink (void *handle, const char *subr)
|
|
|
|
|
{
|
2002-10-05 04:55:22 +00:00
|
|
|
if (scm_lt_dlclose ((scm_lt_dlhandle) handle))
|
2000-01-10 00:36:26 +00:00
|
|
|
{
|
2002-10-03 22:44:48 +00:00
|
|
|
scm_misc_error (subr, (char *) scm_lt_dlerror (), SCM_EOL);
|
2000-01-10 00:36:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void *
|
|
|
|
|
sysdep_dynl_func (const char *symb, void *handle, const char *subr)
|
|
|
|
|
{
|
|
|
|
|
void *fptr;
|
|
|
|
|
|
2002-10-05 04:55:22 +00:00
|
|
|
fptr = scm_lt_dlsym ((scm_lt_dlhandle) handle, symb);
|
2000-01-10 00:36:26 +00:00
|
|
|
if (!fptr)
|
|
|
|
|
{
|
2002-10-03 22:44:48 +00:00
|
|
|
scm_misc_error (subr, (char *) scm_lt_dlerror (), SCM_EOL);
|
2000-01-10 00:36:26 +00:00
|
|
|
}
|
|
|
|
|
return fptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sysdep_dynl_init ()
|
|
|
|
|
{
|
2002-10-03 22:44:48 +00:00
|
|
|
scm_lt_dlinit ();
|
2000-01-10 00:36:26 +00:00
|
|
|
}
|
|
|
|
|
|
2001-06-14 19:50:43 +00:00
|
|
|
scm_t_bits scm_tc16_dynamic_obj;
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2004-05-06 16:43:14 +00:00
|
|
|
#define DYNL_FILENAME SCM_SMOB_OBJECT
|
|
|
|
|
#define DYNL_HANDLE(x) ((void *) SCM_SMOB_DATA_2 (x))
|
|
|
|
|
#define SET_DYNL_HANDLE(x, v) (SCM_SET_SMOB_DATA_2 ((x), (v)))
|
2000-03-14 06:39:37 +00:00
|
|
|
|
|
|
|
|
|
1997-01-18 11:40:31 +00:00
|
|
|
static SCM
|
2000-12-08 17:32:56 +00:00
|
|
|
dynl_obj_mark (SCM ptr)
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
return DYNL_FILENAME (ptr);
|
1997-07-18 14:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
2000-12-08 17:32:56 +00:00
|
|
|
|
1997-01-18 11:40:31 +00:00
|
|
|
static int
|
2000-12-08 17:32:56 +00:00
|
|
|
dynl_obj_print (SCM exp, SCM port, scm_print_state *pstate)
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
scm_puts ("#<dynamic-object ", port);
|
|
|
|
|
scm_iprin1 (DYNL_FILENAME (exp), port, pstate);
|
|
|
|
|
if (DYNL_HANDLE (exp) == NULL)
|
|
|
|
|
scm_puts (" (unlinked)", port);
|
|
|
|
|
scm_putc ('>', port);
|
|
|
|
|
return 1;
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
|
|
|
|
|
1999-06-21 15:16:54 +00:00
|
|
|
|
2000-05-18 08:47:52 +00:00
|
|
|
SCM_DEFINE (scm_dynamic_link, "dynamic-link", 1, 0, 0,
|
2001-04-03 13:19:05 +00:00
|
|
|
(SCM filename),
|
2002-07-10 22:20:16 +00:00
|
|
|
"Find the shared object (shared library) denoted by\n"
|
|
|
|
|
"@var{filename} and link it into the running Guile\n"
|
|
|
|
|
"application. The returned\n"
|
|
|
|
|
"scheme object is a ``handle'' for the library which can\n"
|
|
|
|
|
"be passed to @code{dynamic-func}, @code{dynamic-call} etc.\n\n"
|
|
|
|
|
"Searching for object files is system dependent. Normally,\n"
|
|
|
|
|
"if @var{filename} does have an explicit directory it will\n"
|
|
|
|
|
"be searched for in locations\n"
|
|
|
|
|
"such as @file{/usr/lib} and @file{/usr/local/lib}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
#define FUNC_NAME s_scm_dynamic_link
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
void *handle;
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2001-04-03 13:19:05 +00:00
|
|
|
SCM_VALIDATE_STRING (1, filename);
|
|
|
|
|
handle = sysdep_dynl_link (SCM_STRING_CHARS (filename), FUNC_NAME);
|
|
|
|
|
SCM_RETURN_NEWSMOB2 (scm_tc16_dynamic_obj, SCM_UNPACK (filename), handle);
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
#undef FUNC_NAME
|
1997-01-18 11:40:31 +00:00
|
|
|
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
SCM_DEFINE (scm_dynamic_object_p, "dynamic-object?", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
(SCM obj),
|
2002-07-10 22:20:16 +00:00
|
|
|
"Return @code{#t} if @var{obj} is a dynamic object handle,\n"
|
|
|
|
|
"or @code{#f} otherwise.")
|
1999-12-12 02:36:16 +00:00
|
|
|
#define FUNC_NAME s_scm_dynamic_object_p
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-12-08 17:32:56 +00:00
|
|
|
return SCM_BOOL (SCM_TYP16_PREDICATE (scm_tc16_dynamic_obj, obj));
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
#undef FUNC_NAME
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2000-05-04 08:07:18 +00:00
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
SCM_DEFINE (scm_dynamic_unlink, "dynamic-unlink", 1, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
(SCM dobj),
|
2002-07-10 22:20:16 +00:00
|
|
|
"Unlink a dynamic object from the application, if possible. The\n"
|
|
|
|
|
"object must have been linked by @code{dynamic-link}, with \n"
|
|
|
|
|
"@var{dobj} the corresponding handle. After this procedure\n"
|
|
|
|
|
"is called, the handle can no longer be used to access the\n"
|
|
|
|
|
"object.")
|
1999-12-12 02:36:16 +00:00
|
|
|
#define FUNC_NAME s_scm_dynamic_unlink
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
/*fixme* GC-problem */
|
2000-05-04 08:07:18 +00:00
|
|
|
SCM_VALIDATE_SMOB (SCM_ARG1, dobj, dynamic_obj);
|
|
|
|
|
if (DYNL_HANDLE (dobj) == NULL) {
|
2003-11-08 22:18:01 +00:00
|
|
|
SCM_MISC_ERROR ("Already unlinked: ~S", scm_list_1 (dobj));
|
2000-05-04 08:07:18 +00:00
|
|
|
} else {
|
|
|
|
|
sysdep_dynl_unlink (DYNL_HANDLE (dobj), FUNC_NAME);
|
|
|
|
|
SET_DYNL_HANDLE (dobj, NULL);
|
|
|
|
|
return SCM_UNSPECIFIED;
|
|
|
|
|
}
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
#undef FUNC_NAME
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2000-05-04 08:07:18 +00:00
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
SCM_DEFINE (scm_dynamic_func, "dynamic-func", 2, 0, 0,
|
2000-10-30 11:42:26 +00:00
|
|
|
(SCM name, SCM dobj),
|
2002-07-10 22:20:16 +00:00
|
|
|
"Return a ``handle'' for the function @var{name} in the\n"
|
|
|
|
|
"shared object referred to by @var{dobj}. The handle\n"
|
|
|
|
|
"can be passed to @code{dynamic-call} to actually\n"
|
|
|
|
|
"call the function.\n\n"
|
|
|
|
|
"Regardless whether your C compiler prepends an underscore\n"
|
|
|
|
|
"@samp{_} to the global names in a program, you should\n"
|
|
|
|
|
"@strong{not} include this underscore in @var{name}\n"
|
|
|
|
|
"since it will be added automatically when necessary.")
|
1999-12-12 02:36:16 +00:00
|
|
|
#define FUNC_NAME s_scm_dynamic_func
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-10-30 11:42:26 +00:00
|
|
|
/* The returned handle is formed by casting the address of the function to a
|
|
|
|
|
* long value and converting this to a scheme number
|
|
|
|
|
*/
|
|
|
|
|
|
2000-03-14 06:39:37 +00:00
|
|
|
void (*func) ();
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2000-10-30 11:42:26 +00:00
|
|
|
SCM_VALIDATE_STRING (1, name);
|
2000-03-14 06:39:37 +00:00
|
|
|
/*fixme* GC-problem */
|
2000-05-04 08:07:18 +00:00
|
|
|
SCM_VALIDATE_SMOB (SCM_ARG2, dobj, dynamic_obj);
|
|
|
|
|
if (DYNL_HANDLE (dobj) == NULL) {
|
|
|
|
|
SCM_MISC_ERROR ("Already unlinked: ~S", dobj);
|
|
|
|
|
} else {
|
2000-09-26 18:37:26 +00:00
|
|
|
char *chars;
|
|
|
|
|
|
2000-10-30 11:42:26 +00:00
|
|
|
chars = SCM_STRING_CHARS (name);
|
2000-09-26 18:37:26 +00:00
|
|
|
func = (void (*) ()) sysdep_dynl_func (chars, DYNL_HANDLE (dobj), FUNC_NAME);
|
2000-05-04 08:07:18 +00:00
|
|
|
return scm_ulong2num ((unsigned long) func);
|
|
|
|
|
}
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
#undef FUNC_NAME
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2000-05-04 08:07:18 +00:00
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
SCM_DEFINE (scm_dynamic_call, "dynamic-call", 2, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
(SCM func, SCM dobj),
|
2002-07-09 22:40:03 +00:00
|
|
|
"Call a C function in a dynamic object. Two styles of\n"
|
|
|
|
|
"invocation are supported:\n\n"
|
|
|
|
|
"@itemize @bullet\n"
|
|
|
|
|
"@item @var{func} can be a function handle returned by\n"
|
|
|
|
|
"@code{dynamic-func}. In this case @var{dobj} is\n"
|
|
|
|
|
"ignored\n"
|
|
|
|
|
"@item @var{func} can be a string with the name of the\n"
|
|
|
|
|
"function to call, with @var{dobj} the handle of the\n"
|
|
|
|
|
"dynamic object in which to find the function.\n"
|
|
|
|
|
"This is equivalent to\n"
|
|
|
|
|
"@smallexample\n\n"
|
|
|
|
|
"(dynamic-call (dynamic-func @var{func} @var{dobj}) #f)\n"
|
|
|
|
|
"@end smallexample\n"
|
|
|
|
|
"@end itemize\n\n"
|
|
|
|
|
"In either case, the function is passed no arguments\n"
|
|
|
|
|
"and its return value is ignored.")
|
1999-12-12 02:36:16 +00:00
|
|
|
#define FUNC_NAME s_scm_dynamic_call
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
void (*fptr) ();
|
|
|
|
|
|
2000-10-30 11:42:26 +00:00
|
|
|
if (SCM_STRINGP (func))
|
2000-03-14 06:39:37 +00:00
|
|
|
func = scm_dynamic_func (func, dobj);
|
|
|
|
|
fptr = (void (*) ()) SCM_NUM2ULONG (1, func);
|
|
|
|
|
fptr ();
|
|
|
|
|
return SCM_UNSPECIFIED;
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
#undef FUNC_NAME
|
1997-01-18 11:40:31 +00:00
|
|
|
|
2002-06-30 19:27:18 +00:00
|
|
|
/* return a newly allocated array of char pointers to each of the strings
|
|
|
|
|
in args, with a terminating NULL pointer. */
|
|
|
|
|
/* Note: a similar function is defined in posix.c, but we don't necessarily
|
|
|
|
|
want to export it. */
|
|
|
|
|
static char **allocate_string_pointers (SCM args, int *num_args_return)
|
|
|
|
|
{
|
|
|
|
|
char **result;
|
|
|
|
|
int n_args = scm_ilength (args);
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
SCM_ASSERT (n_args >= 0, args, SCM_ARGn, "allocate_string_pointers");
|
|
|
|
|
result = (char **) scm_malloc ((n_args + 1) * sizeof (char *));
|
|
|
|
|
result[n_args] = NULL;
|
|
|
|
|
for (i = 0; i < n_args; i++)
|
|
|
|
|
{
|
|
|
|
|
SCM car = SCM_CAR (args);
|
|
|
|
|
|
|
|
|
|
if (!SCM_STRINGP (car))
|
|
|
|
|
{
|
|
|
|
|
free (result);
|
|
|
|
|
scm_wrong_type_arg ("allocate_string_pointers", SCM_ARGn, car);
|
|
|
|
|
}
|
|
|
|
|
result[i] = SCM_STRING_CHARS (SCM_CAR (args));
|
|
|
|
|
args = SCM_CDR (args);
|
|
|
|
|
}
|
|
|
|
|
*num_args_return = n_args;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-05 19:05:23 +00:00
|
|
|
SCM_DEFINE (scm_dynamic_args_call, "dynamic-args-call", 3, 0, 0,
|
1999-12-12 02:36:16 +00:00
|
|
|
(SCM func, SCM dobj, SCM args),
|
2001-04-03 13:19:05 +00:00
|
|
|
"Call the C function indicated by @var{func} and @var{dobj},\n"
|
|
|
|
|
"just like @code{dynamic-call}, but pass it some arguments and\n"
|
|
|
|
|
"return its return value. The C function is expected to take\n"
|
|
|
|
|
"two arguments and return an @code{int}, just like @code{main}:\n"
|
* alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
|
|
|
"@smallexample\n"
|
|
|
|
|
"int c_func (int argc, char **argv);\n"
|
|
|
|
|
"@end smallexample\n\n"
|
2001-04-03 13:19:05 +00:00
|
|
|
"The parameter @var{args} must be a list of strings and is\n"
|
|
|
|
|
"converted into an array of @code{char *}. The array is passed\n"
|
|
|
|
|
"in @var{argv} and its size in @var{argc}. The return value is\n"
|
|
|
|
|
"converted to a Scheme number and returned from the call to\n"
|
|
|
|
|
"@code{dynamic-args-call}.")
|
1999-12-12 02:36:16 +00:00
|
|
|
#define FUNC_NAME s_scm_dynamic_args_call
|
1997-01-18 11:40:31 +00:00
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
int (*fptr) (int argc, char **argv);
|
|
|
|
|
int result, argc;
|
|
|
|
|
char **argv;
|
|
|
|
|
|
2000-10-30 11:42:26 +00:00
|
|
|
if (SCM_STRINGP (func))
|
2000-03-14 06:39:37 +00:00
|
|
|
func = scm_dynamic_func (func, dobj);
|
|
|
|
|
|
|
|
|
|
fptr = (int (*) (int, char **)) SCM_NUM2ULONG (1, func);
|
2002-06-30 19:27:18 +00:00
|
|
|
argv = allocate_string_pointers (args, &argc);
|
|
|
|
|
/* if the procedure mutates its arguments, the original strings will be
|
|
|
|
|
changed -- in Guile 1.6 and earlier, this wasn't the case since a
|
|
|
|
|
new copy of each string was allocated. */
|
2000-03-14 06:39:37 +00:00
|
|
|
result = (*fptr) (argc, argv);
|
2002-06-30 19:27:18 +00:00
|
|
|
free (argv);
|
2000-03-14 06:39:37 +00:00
|
|
|
|
|
|
|
|
return SCM_MAKINUM (0L + result);
|
1997-01-18 11:40:31 +00:00
|
|
|
}
|
1999-12-12 02:36:16 +00:00
|
|
|
#undef FUNC_NAME
|
1997-01-18 11:40:31 +00:00
|
|
|
|
1996-12-08 16:52:38 +00:00
|
|
|
void
|
|
|
|
|
scm_init_dynamic_linking ()
|
|
|
|
|
{
|
2000-03-14 06:39:37 +00:00
|
|
|
scm_tc16_dynamic_obj = scm_make_smob_type ("dynamic-object", 0);
|
2000-12-08 17:32:56 +00:00
|
|
|
scm_set_smob_mark (scm_tc16_dynamic_obj, dynl_obj_mark);
|
|
|
|
|
scm_set_smob_print (scm_tc16_dynamic_obj, dynl_obj_print);
|
2000-03-14 06:39:37 +00:00
|
|
|
sysdep_dynl_init ();
|
2000-04-21 14:16:44 +00:00
|
|
|
#include "libguile/dynl.x"
|
1996-12-08 16:52:38 +00:00
|
|
|
}
|
2000-03-19 19:01:16 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Local Variables:
|
|
|
|
|
c-file-style: "gnu"
|
|
|
|
|
End:
|
|
|
|
|
*/
|