$OpenBSD: patch-dynl_c,v 1.1 2004/09/15 19:13:34 espie Exp $ --- dynl.c.orig Sat Jan 25 16:41:11 2003 +++ dynl.c Sun Sep 5 11:41:31 2004 @@ -424,7 +424,23 @@ SCM l_dyn_call(symb, shl) ASRTER(NIMP(symb) && STRINGP(symb), symb, ARG1, s_call); ASRTER(NIMP(shl) && CAR(shl)==tc16_shl, shl, ARG2, s_call); DEFER_INTS; - func = dlsym(SHL(shl), CHARS(symb)); +#ifdef __OpenBSD__ +# ifndef __ELF__ + { + char *n; + + n = malloc(LENGTH(symb)+2); + if (n) { + *n = '_'; + strcpy(n+1, CHARS(symb)); + func = dlsym(SHL(shl), n); + free(n); + } + } +# endif +#endif + if (!func) + func = dlsym(SHL(shl), CHARS(symb)); if (!func) { char *dlr = dlerror(); ALLOW_INTS; @@ -453,7 +469,23 @@ SCM l_dyn_main_call(symb, shl, args) ASRTER(NIMP(symb) && STRINGP(symb), symb, ARG1, s_main_call); ASRTER(NIMP(shl) && CAR(shl)==tc16_shl, shl, ARG2, s_main_call); DEFER_INTS; - func = dlsym(SHL(shl), CHARS(symb)); +#ifdef __OpenBSD__ +# ifndef __ELF__ + { + char *n; + + n = malloc(LENGTH(symb)+2); + if (n) { + *n = '_'; + strcpy(n+1, CHARS(symb)); + func = dlsym(SHL(shl), n); + free(n); + } + } +# endif +#endif + if (!func) + func = dlsym(SHL(shl), CHARS(symb)); if (!func) { char *dlr = dlerror(); ALLOW_INTS;