<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div dir="ltr" data-setdir="false">I have created a dll of C++ GDAL functions callable from a REX (OOREXX). It has functions like  gdal_translate, gdalinfo, <span>Rgb2Pct and a few others. </span></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><span>Recently I got into using shapefiles so I added a ogr2ogr  function modeled on the </span></div><div dir="ltr" data-setdir="false"><span><span>C:\release-1911-gdal-2-4-1-mapserver-7-2-2-src\gdal\apps\ogr2ogr_bin.cpp </span> program</span></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><span>This new function works fine except if I make two calls that have a select statement in it like:</span></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><div><div>sql = "SELECT * FROM My_Points point" </div><div dir="ltr" data-setdir="false">options = ' <span>-f "ESRI Shapefile"</span> -dialect sqlite -sql ""'sql'""' </div><div dir="ltr" data-setdir="false">rc = ogr2ogr(input_file,output_file,options,0,diagmsgs)  -- <<  first call works</div></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">rc = ogr2ogr(input_file,output_file,options,0,diagmsgs)  -- << second call causes a crash</span></span><br></div></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><span>The first call works but the second call fails when the function calls  <span>GDALVectorTranslate.  it never returns and the program crashes.  It doesn't matter what output driver I use or if the input_file and output_file are different.</span></span></div><div dir="ltr" data-setdir="false"><span><span><br></span></span></div><div dir="ltr" data-setdir="false">Does anyone have any idea why the second call would fail or have an example of an ogr2ogr cpp program that works.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thanks</div></div></body></html>