[gdal-dev] Crash when using custom error handler
Thomas Sevaldrud
thomas at silentwings.no
Fri Feb 14 03:47:17 PST 2014
Hi,
I am having a very strange issue when trying to use a custom error handler
in GDAL on windows.
The following simple example illustrates it:
#include <cpl_error.h>
#include <iostream>
using namespace std;
static void logGDALError(CPLErr eErrClass, int err_no, const char *msg)
{
cerr << "GDAL Error: " << msg << endl;
}
int main(int argc, char *argv[])
{
cerr << "Begin" << endl;
CPLSetErrorHandler((CPLErrorHandler)logGDALError);
CPLError(CE_Warning, 0, "Installed error handler");
cerr << "End" << endl;
}
This code crashes immediately after writing out the message "Installed
error handler".
Unhandled exception at 0x7787ea3b in GDALTest.exe: 0xC0000005: Access
violation writing location 0x00000009.
Both GDAL and the test program are compiled with VS2010 in 32-bit mode. I
have also tried with VS2012 with the same result. I've tried with GDAL
1.9.2 and 1.10.1.
I used the supplied makefiles to compile GDAL and everything else seems to
work OK. I.e I use the GDAL API successfully to read and write files.
Any ideas?
- Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140214/91fdbd88/attachment.html>
More information about the gdal-dev
mailing list