diff options
author | Rob Browning <rlb@cs.utexas.edu> | 1997-12-12 17:29:42 -0600 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:24 -0800 |
commit | f64b2806c1d66a1341bb8b1491f384169ab1d65f (patch) | |
tree | 8b97dbe3640c60927959b0e63461ef9fcae591e0 /dynl.c | |
parent | 6dcb175d7f34d9f5a0b3ba623f94454ec16a73d6 (diff) | |
parent | 1edcb9b62a1a520eddae8403c19d841c9b18737f (diff) | |
download | scm-f64b2806c1d66a1341bb8b1491f384169ab1d65f.tar.gz scm-f64b2806c1d66a1341bb8b1491f384169ab1d65f.zip |
Import Debian changes 5b3-1debian/5b3-1
scm (5b3-1) unstable; urgency=low
* New maintainer
* New version
* libc6
Diffstat (limited to 'dynl.c')
-rw-r--r-- | dynl.c | 35 |
1 files changed, 32 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997 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 @@ -156,8 +156,7 @@ static iproc subr1s[] = { void init_dynl() { # ifndef RTL - if (!execpath) execpath = dld_find_executable(CHARS(CAR(progargs))); - if (dld_init(execpath)) { + if ((!execpath) || dld_init(execpath)) { dld_perror("DLD:"); /* wta(CAR(progargs), "couldn't init", "dld"); */ return; @@ -420,6 +419,35 @@ SCM l_dyn_call(symb, shl) /* *loc_loadpath = oloadpath; */ return BOOL_T; } +static char s_main_call[] = "dyn:main-call"; +SCM l_dyn_main_call(symb, shl, args) + SCM symb, shl, args; +{ + int i; + int (*func)P((int argc, char **argv)) = 0; + char **argv; +/* SCM oloadpath = *loc_loadpath; */ + ASSERT(NIMP(symb) && STRINGP(symb), symb, ARG1, s_main_call); + ASSERT(NIMP(shl) && CAR(shl)==tc16_shl, shl, ARG2, s_main_call); + DEFER_INTS; + func = dlsym(SHL(shl), CHARS(symb)); + if (!func) { + const char *dlr = dlerror(); + ALLOW_INTS; + if (dlr) puts(dlr); + return BOOL_F; + } + argv = makargvfrmstrs(args, s_main_call); + ALLOW_INTS; +/* *loc_loadpath = linkpath; */ + i = (*func) ((int)ilength(args), argv); +/* *loc_loadpath = oloadpath; */ + DEFER_INTS; + must_free_argv(argv); + ALLOW_INTS; + return MAKINUM(0L+i); +} + static char s_unlink[] = "dyn:unlink"; SCM l_dyn_unlink(shl) SCM shl; @@ -443,6 +471,7 @@ void init_dynl() tc16_shl = newsmob(&shlsmob); init_iprocs(subr1s, tc7_subr_1); make_subr(s_call, tc7_subr_2, l_dyn_call); + make_subr(s_main_call, tc7_lsubr_2, l_dyn_main_call); add_feature("sun-dl"); } #endif /* SUN_DL */ |