diff options
author | Matti Picus <matti.picus@gmail.com> | 2021-02-05 15:24:55 +0200 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2021-02-05 15:24:55 +0200 |
commit | ba70072cc19577ff66ace016c9fb46b44b093ecb (patch) | |
tree | dc3384efca48037c171e9dbd8b3e4ef7721a181f | |
parent | typo (diff) | |
download | pypy-ba70072cc19577ff66ace016c9fb46b44b093ecb.tar.gz pypy-ba70072cc19577ff66ace016c9fb46b44b093ecb.tar.bz2 pypy-ba70072cc19577ff66ace016c9fb46b44b093ecb.zip |
add new file
-rw-r--r-- | lib_pypy/pypy_tools/_ctypes_build.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib_pypy/pypy_tools/_ctypes_build.py b/lib_pypy/pypy_tools/_ctypes_build.py new file mode 100644 index 0000000000..6829353819 --- /dev/null +++ b/lib_pypy/pypy_tools/_ctypes_build.py @@ -0,0 +1,23 @@ +import os + +from cffi import FFI + +ffi = FFI() +ffi.cdef('bool dyld_shared_cache_contains_path(const char* path);') +ffi.set_source('_ctypes_cffi', r''' +#include <stdbool.h> +#include <mach-o/dyld.h> + +bool _dyld_shared_cache_contains_path(const char* path) __attribute__((weak_import)); +bool dyld_shared_cache_contains_path(const char* path) { + if (_dyld_shared_cache_contains_path == NULL) { + return false; + } + return _dyld_shared_cache_contains_path(path); +} +''') + +if __name__ == '__main__': + os.chdir(os.path.dirname(__file__)) + ffi.compile() + |