<div dir="ltr"><div>I'm getting started with GDAL.</div><div><br></div><div>I've had success running GDAL code in a windows 32 bit console app running in Visual Studio 2017 on Windows 10 64 bit using these files and directories:</div><div>    \release-1911-gdal-3-0-2-mapserver-7-4-2-libs\lib\gdal_i.lib (for linking my code)<br>    \release-1911-gdal-3-0-2-mapserver-7-4-2-libs\include (for compiling my code)<br></div><div>    \release-1911-gdal-3-0-2-mapserver-7-4-2\bin (for DLLs required at runtime)<br></div><div>which I got from  <a href="http://download.gisinternals.com/query.html?content=filelist&file=release-1911-gdal-3-0-2-mapserver-7-4-2.zip">http://download.gisinternals.com/query.html?content=filelist&file=release-1911-gdal-3-0-2-mapserver-7-4-2.zip</a> <br></div><div><br></div><div>I can successfully load a wkt projection file from the console using this code without any problems</div><div>    OGRSpatialReference oSRS;<br>    oSRS.importFromWkt(&pszWkt_tmp);<br>    oSRS.dumpReadable();<br></div><div><br></div><div><br></div><div>Now I'm trying to integrate this very simple code into my own 32 bit DLL which is loaded dynamically by an "off-the-shelf" 32 bit app. </div><div><br></div><div>I've written many of these dynamically loaded DLLs before, but when I try to integrate GDAL into my new DLL, I get an exception when the GDAL DLLs are being loaded __before_it_ever_gets_to_my_code_. Its stopping seemingly while loading the GDAL dlls. </div><div><br></div><div>The exception occurs (according to the 

Visual Studio 2017 debugger - "Exception thrown: write access violation. *this* was nullptr") before entry into the 

OGREnvelope constructor at line 60 in ogr_core.h. There is no call stack shown unfortunately so I've got no idea where the initialization call is coming from.</div><div> <br></div>class CPL_DLL OGREnvelope<br>{<br>  public:<br>        OGREnvelope() : MinX(std::numeric_limits<double>::infinity()),          <-- 

 "Exception thrown: write access violation. *this* was nullptr"<br>                        MaxX(-std::numeric_limits<double>::infinity()),<br>                        MinY(std::numeric_limits<double>::infinity()),<br>                        MaxY(-std::numeric_limits<double>::infinity())<br>        {<br>        }<br clear="all"><div><br></div><div>I've tried setting the environment variables</div><div>   GDAL_DATA=D:\release-1911-gdal-2-4-3-mapserver-7-4-2\bin\gdal-data<br>   PROJ_LIB=D:\release-1911-gdal-2-4-3-mapserver-7-4-2\bin\proj6\share<br></div><div>but this does not seem to change anything</div><div><br></div><div>I appreciate that I am running in a bit of a "niche" environment (32 bit windows DLL dynamically loaded by a 3rd party app) but if anybody has any suggestions as to what I might try to make this work I would be very grateful! </div><div><br></div><div>Thanks</div><div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-o-</div></div>