Skip to content

Commit

Permalink
Drop support for OSX 10.3 and earlier
Browse files Browse the repository at this point in the history
dlopen was introduced in OSX 10.4, which was released in 2005. OSX 10.3
was EOL in 2007.
  • Loading branch information
peterzhu2118 committed Jan 14, 2022
1 parent 64e19ad commit 3cc82ff
Showing 1 changed file with 2 additions and 54 deletions.
56 changes: 2 additions & 54 deletions dln.c
Expand Up @@ -74,15 +74,6 @@ void *xrealloc();
char *getenv();
#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
static void
dln_loaderror(const char *format, ...)
Expand All @@ -95,12 +86,12 @@ dln_loaderror(const char *format, ...)
}
#endif

#if defined(HAVE_DLOPEN) && !defined(_AIX) && !defined(MACOSX_DYLD) && !defined(_UNICOSMP)
#if defined(HAVE_DLOPEN) && !defined(_AIX) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#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 "_"
#else
# define EXTERNAL_PREFIX ""
Expand Down Expand Up @@ -168,10 +159,6 @@ static const char funcname_prefix[sizeof(FUNCNAME_PREFIX) - 1] = FUNCNAME_PREFIX
#define NSLINKMODULE_OPTION_BINDNOW 1
#endif
#endif
#else
#ifdef MACOSX_DYLD
#include <mach-o/dyld.h>
#endif
#endif

#ifdef _WIN32
Expand Down Expand Up @@ -449,45 +436,6 @@ dln_load(const char *file)
}
#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
dln_notimplement();
#endif
Expand Down

0 comments on commit 3cc82ff

Please sign in to comment.