[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
This commit is contained in:
parent
db867be91e
commit
30c6021f80
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Error checking functions for GEOS ctypes prototype functions.
|
Error checking functions for GEOS ctypes prototype functions.
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
from ctypes import c_void_p, string_at, CDLL
|
from ctypes import c_void_p, string_at, CDLL
|
||||||
from django.contrib.gis.geos.error import GEOSException
|
from django.contrib.gis.geos.error import GEOSException
|
||||||
from django.contrib.gis.geos.libgeos import lgeos, GEOS_VERSION
|
from django.contrib.gis.geos.libgeos import lgeos, GEOS_VERSION
|
||||||
|
@ -15,8 +16,12 @@ if GEOS_VERSION >= (3, 1, 1):
|
||||||
free.restype = None
|
free.restype = None
|
||||||
else:
|
else:
|
||||||
# Getting the `free` routine from the C library of the platform.
|
# Getting the `free` routine from the C library of the platform.
|
||||||
# The C library is obtained by passing None into `CDLL`.
|
if os.name == 'nt':
|
||||||
libc = CDLL(None)
|
# 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
|
free = libc.free
|
||||||
|
|
||||||
### ctypes error checking routines ###
|
### ctypes error checking routines ###
|
||||||
|
|
Loading…
Reference in New Issue