Skip to content

Commit

Permalink
RTLD_GLOBAL for CDLL with wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Dec 30, 2017
1 parent e8e3c5e commit 1444ed2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions shapely/geos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import atexit
from ctypes import (
CDLL, cdll, pointer, string_at, DEFAULT_MODE, c_void_p, c_size_t, c_char_p)
CDLL, cdll, pointer, string_at, DEFAULT_MODE, RTLD_GLOBAL, c_void_p,
c_size_t, c_char_p)
from ctypes.util import find_library
import glob
import logging
Expand All @@ -14,7 +15,8 @@
import threading

from .ctypes_declarations import prototype, EXCEPTION_HANDLER_FUNCTYPE
from .errors import WKBReadingError, WKTReadingError, TopologicalError, PredicateError
from .errors import (
WKBReadingError, WKTReadingError, TopologicalError, PredicateError)
from . import ftools


Expand All @@ -24,6 +26,7 @@
# Find and load the GEOS and C libraries
# If this ever gets any longer, we'll break it into separate modules


def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
lib = find_library(libname)
dll = None
Expand Down Expand Up @@ -82,7 +85,7 @@ def load_dll(libname, fallbacks=None, mode=DEFAULT_MODE):
geos_whl_dylib = os.path.abspath(os.path.join(os.path.dirname(
__file__), '.dylibs/libgeos_c.1.dylib'))
if os.path.exists(geos_whl_dylib):
_lgeos = CDLL(geos_whl_dylib)
_lgeos = CDLL(geos_whl_dylib, mode=RTLD_GLOBAL)
LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)

else:
Expand Down

0 comments on commit 1444ed2

Please sign in to comment.