summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2009-12-29 10:41:44 +0000
committerJustin Bronn <jbronn@gmail.com>2009-12-29 10:41:44 +0000
commit30c6021f80b5b7051a77b3df508ed41bcffcb8aa (patch)
tree64a01b7d21168b25bc7f9480ebd95da4ca8a1902
parentdb867be91e10ef5f5f3ee929d92dc87454651895 (diff)
[1.1.X] When `GEOSFree` is not available on NT platforms, have to specifically use the MS C library.
Backport of r12024 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12025 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/gis/geos/prototypes/errcheck.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/django/contrib/gis/geos/prototypes/errcheck.py b/django/contrib/gis/geos/prototypes/errcheck.py
index 0d5e9e24fc..a00b93be6e 100644
--- a/django/contrib/gis/geos/prototypes/errcheck.py
+++ b/django/contrib/gis/geos/prototypes/errcheck.py
@@ -1,6 +1,7 @@
"""
Error checking functions for GEOS ctypes prototype functions.
"""
+import os
from ctypes import c_void_p, string_at, CDLL
from django.contrib.gis.geos.error import GEOSException
from django.contrib.gis.geos.libgeos import lgeos, GEOS_VERSION
@@ -15,8 +16,12 @@ if GEOS_VERSION >= (3, 1, 1):
free.restype = None
else:
# Getting the `free` routine from the C library of the platform.
- # The C library is obtained by passing None into `CDLL`.
- libc = CDLL(None)
+ if os.name == 'nt':
+ # On NT, use the MS C library.
+ libc = CDLL('msvcrt')
+ else:
+ # On POSIX platforms C library is obtained by passing None into `CDLL`.
+ libc = CDLL(None)
free = libc.free
### ctypes error checking routines ###