[Gdal-dev] SDE driver crashes in Windows

Paul, Michael michael.paul at tao.es
Mon Mar 20 08:41:36 EST 2006


Hi,
 
I have obtained the SDE driver from latest CVS snapshot and compiled on
Windows with VC8 (Visual Studio 2005). 
 
As I am accessing the GDAL dll from C# I had to make some additional steps,
which are not necessary when compiling with earlier versions of Visual C++:
- nmake /f makefile.vc
- mt /manifest gdal13.dll.manifest /outputresource:gdal13.dll;#2
(this is new to VS 2005)
- cd ogr/ogrsf_formats/sde
- nmake /f makefile.vc ogr_SDE.dll
- mt /manifest ogr_SDE.dll.manifest /outputresource:ogr_SDE.dll;#2
(this is new to VS 2005)
 
Thanks to MS, VC8 automatically generates a .manifest file for all DLLs
generated by GDAL makefiles (I suppose this will apply to almost any
existing makefiles ...). And thanks to MS, this additional .manifest file is
useless for C# environments and must be included as resource with ID 2.
Without that people will obtain a fine DllNotFoundException from .Net ("the
specified module could not be found" or sth.) AND from C++ apps linking to
GDAL dll. 
 
Now, my really problem: using the new SDE driver already everything is
working, except access to date fields. Currently I am obtaining a Win32
exception, after that the application is terminated automatically by vcrt.
The error occurs within the following line ogrsdelayer.cpp ( line 799):
strftime( szDate, sizeof(szDate), "%T %m/%d/%Y", &sDateVal );

 

I have debugged and sDateVal seems to contain valid data (Mar. 15th of
2004):

tm_sec=0
tm_min=0
tm_hour=0
tm_mday=15
tm_mon=2
tm_year=104
tm_wday=1
tm_yday=75
tm_isdst=-1

In other cases, many of these date errors are having to do with regional
settings. I am not an expert in C++, but looking at the following URL I did
not see any mention to the %T format string (may be it is only defined in
UNIX systems?):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/
_crt_strftime.2c_.wcsftime.asp
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html
/_crt_strftime.2c_.wcsftime.asp> 

For the moment, I thought a classic sprintf may help:

sprintf(szDate, "%02i:%02i:%02i
%02i/%02i/%i",sDateVal.tm_hour,sDateVal.tm_min,sDateVal.tm_sec,sDateVal.tm_m
day,sDateVal.tm_mon,sDateVal.tm_year+1900); //here the '2' is the precision

With this change, at least a call to GetNextFeature() does not crash.

Regards.
 
Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060320/4c8e9d48/attachment.html


More information about the Gdal-dev mailing list