mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 22:24:13 +08:00
mdbx: use _tlv_atexit()
on Darwin/MacOSX.
This commit is contained in:
parent
abac366eac
commit
c082eb7d8a
@ -158,6 +158,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
#ifndef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
|
#define MAC_OS_X_VERSION_MIN_REQUIRED 1070 /* Mac OS X 10.7, 2011 */
|
||||||
|
#endif
|
||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
#endif /* Apple OSX & iOS */
|
#endif /* Apple OSX & iOS */
|
||||||
|
|
||||||
|
17
src/core.c
17
src/core.c
@ -1259,6 +1259,23 @@ static __inline int rthc_atexit(void (*dtor)(void *), void *obj,
|
|||||||
void *dso_symbol) {
|
void *dso_symbol) {
|
||||||
int rc = MDBX_ENOSYS;
|
int rc = MDBX_ENOSYS;
|
||||||
|
|
||||||
|
#if defined(__APPLE__) || defined(_DARWIN_C_SOURCE)
|
||||||
|
#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || !defined(MAC_OS_X_VERSION_10_7)
|
||||||
|
#error \
|
||||||
|
"The <AvailabilityMacros.h> should be included and MAC_OS_X_VERSION_MIN_REQUIRED must be defined"
|
||||||
|
#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7
|
||||||
|
extern void _tlv_atexit(void (*termfunc)(void *objAddr), void *objAddr)
|
||||||
|
__attribute__((__weak__, __weak_import__));
|
||||||
|
if (rc && &_tlv_atexit) {
|
||||||
|
(void)dso_symbol;
|
||||||
|
_tlv_atexit(dtor, obj);
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
#elif !defined(MDBX_HAVE_CXA_THREAD_ATEXIT)
|
||||||
|
#define MDBX_HAVE_CXA_THREAD_ATEXIT 1
|
||||||
|
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
|
||||||
|
#endif /* Apple */
|
||||||
|
|
||||||
#if defined(MDBX_HAVE_CXA_THREAD_ATEXIT) && MDBX_HAVE_CXA_THREAD_ATEXIT
|
#if defined(MDBX_HAVE_CXA_THREAD_ATEXIT) && MDBX_HAVE_CXA_THREAD_ATEXIT
|
||||||
extern int __cxa_thread_atexit(void (*dtor)(void *), void *obj,
|
extern int __cxa_thread_atexit(void (*dtor)(void *), void *obj,
|
||||||
void *dso_symbol)
|
void *dso_symbol)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user