Drop support for OSX 10.3 and earlier

dlopen was introduced in OSX 10.4, which was released in 2005. OSX 10.3
was EOL in 2007.
This commit is contained in:
Peter Zhu 2022-01-14 10:33:42 -05:00
Родитель 64e19ad7e9
Коммит 3cc82ff93c
1 изменённых файлов: 2 добавлений и 54 удалений

56
dln.c
Просмотреть файл

@ -74,15 +74,6 @@ void *xrealloc();
char *getenv(); char *getenv();
#endif #endif
#ifdef __APPLE__
# if defined(HAVE_DLOPEN)
/* Mac OS X with dlopen (10.3 or later) */
# define MACOSX_DLOPEN
# else
# define MACOSX_DYLD
# endif
#endif
#ifndef dln_loaderror #ifndef dln_loaderror
static void static void
dln_loaderror(const char *format, ...) dln_loaderror(const char *format, ...)
@ -95,12 +86,12 @@ dln_loaderror(const char *format, ...)
} }
#endif #endif
#if defined(HAVE_DLOPEN) && !defined(_AIX) && !defined(MACOSX_DYLD) && !defined(_UNICOSMP) #if defined(HAVE_DLOPEN) && !defined(_AIX) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */ /* dynamic load with dlopen() */
# define USE_DLN_DLOPEN # define USE_DLN_DLOPEN
#endif #endif
#if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(NeXT) || defined(MACOSX_DYLD) #if defined(__hp9000s300) || ((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(__ELF__)) || defined(NeXT)
# define EXTERNAL_PREFIX "_" # define EXTERNAL_PREFIX "_"
#else #else
# define EXTERNAL_PREFIX "" # define EXTERNAL_PREFIX ""
@ -168,10 +159,6 @@ static const char funcname_prefix[sizeof(FUNCNAME_PREFIX) - 1] = FUNCNAME_PREFIX
#define NSLINKMODULE_OPTION_BINDNOW 1 #define NSLINKMODULE_OPTION_BINDNOW 1
#endif #endif
#endif #endif
#else
#ifdef MACOSX_DYLD
#include <mach-o/dyld.h>
#endif
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
@ -449,45 +436,6 @@ dln_load(const char *file)
} }
#endif /* _AIX */ #endif /* _AIX */
#if defined(MACOSX_DYLD)
#define DLN_DEFINED
/*----------------------------------------------------
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
Special Thanks...
Yu tomoak-i@is.aist-nara.ac.jp,
Mi hisho@tasihara.nest.or.jp,
sunshine@sunshineco.com,
and... Miss ARAI Akino(^^;)
----------------------------------------------------*/
{
int dyld_result;
NSObjectFileImage obj_file; /* handle, but not use it */
/* "file" is module file name .
"buf" is pointer to initial function name with "_" . */
void (*init_fct)(void);
dyld_result = NSCreateObjectFileImageFromFile(file, &obj_file);
if (dyld_result != NSObjectFileImageSuccess) {
dln_loaderror("Failed to load %.200s", file);
}
NSLinkModule(obj_file, file, NSLINKMODULE_OPTION_BINDNOW);
/* lookup the initial function */
if (!NSIsSymbolNameDefined(buf)) {
dln_loaderror("Failed to lookup Init function %.200s",file);
}
init_fct = NSAddressOfSymbol(NSLookupAndBindSymbol(buf));
(*init_fct)();
return (void*)init_fct;
}
#endif
#ifndef DLN_DEFINED #ifndef DLN_DEFINED
dln_notimplement(); dln_notimplement();
#endif #endif