$NetBSD: patch-ae,v 1.3 2015/12/29 23:34:43 dholland Exp $ Update dlopen machinery for NetBSD and FreeBSD, and support Dragonfly. --- Src/dynload.c.orig 1999-09-26 15:02:14.000000000 +0000 +++ Src/dynload.c @@ -46,16 +46,19 @@ # include #endif -#if defined(NETBSD1) +#if defined(NETBSD) +#if defined(__ELF__) +# include +#else # include # include # include # define dlerror() "error unknown" /* dlerror() isn't implemented in NetBSD 1.0 */ +#endif # define DLOPEN_COMPATIBLE #endif -#if defined(FREEBSD) -# define dlerror() "error unknown" /* dlerror() isn't implemented in FreeBSD too */ +#if defined(FREEBSD) || defined(DRAGONFLY) # define DLOPEN_COMPATIBLE #endif @@ -172,7 +175,7 @@ static void load_and_call(char *path, ch #endif /* MSC_VER WIN32 */ -#if defined(SUNOS4) || defined(SUNOS5) || defined(NETBSD1) || defined(FREEBSD) || defined(IRIX5) || defined(OSF1) ||defined(LINUX_ELF) +#if defined(SUNOS4) || defined(SUNOS5) || defined(NETBSD) || defined(FREEBSD) || defined(IRIX5) || defined(OSF1) ||defined(LINUX_ELF) || defined(DRAGONFLY) #define MAKE_STAT_PTR(p) (STk_make_Cpointer(ANONYMOUS_STAT_PTR_ID, (p), TRUE)) #define MAKE_DYN_PTR(p) (STk_make_Cpointer(ANONYMOUS_DYN_PTR_ID, (p), FALSE)) @@ -360,7 +363,7 @@ void STk_load_object_file(char *path) for (p = path, slash = p-1; *p; p++) /* Find position of last '/' */ if (*p == '/') slash = p; -#if defined(NETBSD1) +#if defined(NETBSD) && !defined(__ELF__) sprintf(fct_name, "_STk_init_%s", slash + 1); #else sprintf(fct_name, "STk_init_%s", slash + 1);