From 56c6e1a42f1856103177e7ca10680c28f1b69726 Mon Sep 17 00:00:00 2001 From: Xiaoqiang Wang Date: Thu, 5 Dec 2019 10:02:45 +0100 Subject: [PATCH] support macOS UNIX macro is from configure/os/CONFIG.Common.UnixCommon --- require.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/require.c b/require.c index 2de067f..b094427 100644 --- a/require.c +++ b/require.c @@ -8,7 +8,7 @@ * DISCLAIMER: Use at your own risc and so on. No warranty, no refund. */ -#ifdef __unix +#ifdef UNIX /* for vasprintf and dl_iterate_phdr */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -138,7 +139,7 @@ int requireDebug; return buf; } -#elif defined(__unix) +#elif defined(UNIX) #ifndef OS_CLASS #ifdef __linux @@ -179,6 +180,10 @@ int requireDebug; #define PREFIX #define INFIX #define EXT ".dll" + #elif defined(darwin) + #define PREFIX "lib" + #define INFIX + #define EXT ".dylib" #else #define PREFIX "lib" #define INFIX @@ -288,7 +293,7 @@ static HMODULE loadlib(const char* libname) return NULL; } -#if defined (__unix) +#if defined (UNIX) if ((libhandle = dlopen(libname, RTLD_NOW|RTLD_GLOBAL)) == NULL) { fprintf (stderr, "Loading %s library failed: %s\n",