<html>
<head>
   <meta http-equiv=Content-Type content="text/html; charset=ks_c_5601-1987">
   <style type="text/css">div, span, p { padding: 0px; margin:0cm; margin-bottom:3.5pt; text-align:justify; text-justify:inter-ideograph; text-autospace:none; word-break:break-hangul; font-size: 10pt; }; p.fcknormal, li.fcknormal, div.fcknormal { padding: 0px; margin:0cm; margin-bottom:3.5pt; text-align:justify; text-justify:inter-ideograph; text-autospace:none; word-break:break-hangul; font-size: 10pt };</style>
</head>

<body link="blue" vlink="purple">
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">
<p style="margin: 0px;  font: 10pt malgun gothic;">  </p>

<div link="blue" vlink="purple">
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">I build GDAL library just opening "makegdal10.sln".</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">My test program is just simple console application with VS2010 without any added configuration.</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">GDAL : f:\gdal-1.10.0\</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">Test program include config : f:\gdal-1.10.0\port\;f:\gdal-1.10.0\gcore;f:\gdal-1.10.0\ogr;f:\gdal-1.10.0\frmts;</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">Test program link path : f:\gdal-1.10.0\gdal_i.lib</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt"> </p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">In my thought, my program may use same sources with GDAL.</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt"> </p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">Is there any GDAL configuration for my program?</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt"> </p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">Thanks.</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt">Seung Ae</p>
<p class="fcknormal" style="margin-top:5;margin-bottom:5; font-family:¸¼Àº °íµñ; font-size:10pt"> </p>
<blockquote dir="ltr" style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left: #000000 2px solid; margin-right: 0px">
<p style="margin: 0px; font: 10pt malgun gothic;">----- Original Message -----</p>
<p style="margin: 0px; font: 10pt malgun gothic; background: #e4e4e4; font-color: black;"><b>From:</b> Frank Warmerdam [warmerdam@pobox.com]</p>
<p style="margin: 0px; font: 10pt malgun gothic;"><b>To:</b> Seung Ae Lim [salim@pixoneer.co.kr]</p>
<p style="margin: 0px; font: 10pt malgun gothic;"><b>Cc:</b> gdal dev [gdal-dev@lists.osgeo.org]</p>
<p style="margin: 0px; font: 10pt malgun gothic;"><b>Sent:</b> Fri , November 08, 2013 01:31 AM</p>
<p style="margin: 0px; font: 10pt malgun gothic;"><b>Subject:</b> Re: [gdal-dev] NewDataset and SetBand error</p>
<p style="margin: 0px;  font: 10pt malgun gothic;"> </p>
<div dir="ltr">
<div>
<div>
<div>Seung,<br />
 </div>
If the fields, like papoBands in the dataset seem ok before stepping into SetBand(), and corrupt once you are inside I would suspect that GDAL and your application have been built with different gdal_priv.h include files *or* with different structure alighnments flags for Visual Studio.   Did you build GDAL from source using the same configuration you are building your application with?</div>
Best regards,</div>
Frank<br />
 </div>
<div class="gmail_extra"><br />
<br />
<div class="gmail_quote">On Thu, Nov 7, 2013 at 1:03 AM, Seung Ae Lim <span dir="ltr"><  <a href="mailto:salim@pixoneer.co.kr" target="_blank">salim@pixoneer.co.kr</a>  ></span> wrote:<br />
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple">
<p> Dear,</p>
<p> </p>
<p> I make a console application with VS2010 linking "gdal_i.lib".</p>
<p> The steps are :</p>
<p><strong> 1. Create New Dataset and Band in main.cpp</strong></p>
<div>class XXDataset : public GDALPamDataset</div>
<div>{</div>
<div>public:</div>
<div><span style="white-space:pre-wrap">  </span>XXDataset() {};</div>
<div><span style="white-space:pre-wrap">  </span>~XXDataset() {};</div>
<div> </div>
<div><span style="white-space:pre-wrap">  </span>static GDALDataset* Open(GDALOpenInfo*);</div>
<div>};</div>
<div> </div>
<div>class XXRasterBand : public GDALPamRasterBand</div>
<div>{</div>
<div>public:</div>
<div><span style="white-space:pre-wrap">  </span>XXRasterBand( GDALDataset*, int, GDALDataType );</div>
<div><span style="white-space:pre-wrap">  </span>~XXRasterBand() {};</div>
<div>};</div>
<div> </div>
<div>
<div> </div>
<div>GDALDataset* XXDataset::Open(GDALOpenInfo* pOpenInfo)</div>
<div>{</div>
<div><span style="white-space:pre-wrap">  </span>XXDataset* poDS = new XXDataset();</div>
<div><span style="white-space:pre-wrap">  </span>poDS-   >nRasterXSize = 100;</div>
<div><span style="white-space:pre-wrap">  </span>poDS-   >nRasterYSize = 200;</div>
<div><span style="white-space:pre-wrap">  </span>poDS-   >eAccess = GA_Update;</div>
<div><span style="white-space:pre-wrap">  </span>poDS-   >nBands = 3;</div>
<div> </div>
<div><span style="white-space:pre-wrap">  </span>int iBand = 0;</div>
<div><span style="white-space:pre-wrap">  </span>for(iBand = 1; iBand <   = 3; iBand++ )</div>
<div><span style="white-space:pre-wrap">  </span>{</div>
<div><span style="white-space:pre-wrap">          </span>XXRasterBand* band = new XXRasterBand( poDS, iBand, GDT_Byte);</div>
<div><span style="white-space:pre-wrap">          </span>poDS-   >SetBand( iBand, band );</div>
<div><span style="white-space:pre-wrap">  </span>}</div>
<div> </div>
<div><span style="white-space:pre-wrap">  </span>return poDS;</div>
<div>}</div>
<div> </div>
<div>XXRasterBand::XXRasterBand( GDALDataset *poDS, int nBand, GDALDataType eType)</div>
<div>{</div>
<div><span style="white-space:pre-wrap">  </span>this-   >poDS = poDS;</div>
<div><span style="white-space:pre-wrap">  </span>this-   >nBand = nBand;</div>
<div><span style="white-space:pre-wrap">  </span>this-   >eDataType = eType;</div>
<div><span style="white-space:pre-wrap">  </span>nRasterXSize = 100;</div>
<div><span style="white-space:pre-wrap">  </span>nRasterYSize = 200;</div>
<div><span style="white-space:pre-wrap">  </span>nBlockXSize = nRasterXSize;</div>
<div><span style="white-space:pre-wrap">  </span>nBlockYSize = nRasterYSize;</div>
<div>}</div>
<div> </div>
<div><strong>2. Add the code in main function</strong></div>
<div>void main()</div>
<div>{</div>
<div> </div>
<div> </div>
<div>            GDALDataset* pDSTemp = XXDataset::Open(NULL);</div>
<div><span style="white-space:pre-wrap">  </span>if (pDSTemp) GDALClose(pDSTemp);</div>
<div>}</div>
</div>
<div> </div>
<div> </div>
<div>I compile and try to debug this app.</div>
<div>But in "poDS-  >SetBand" line of "XXDataset::Open", the app is broken when the first band is ready to set.</div>
<div>In XXDataset::Open, all value of parameters is right.</div>
<div>But When stepping into the "SetBand" function, the values may be corrupted.</div>
<div>"papobands" of GDALDataset is not null and it make an error.</div>
<div> </div>
<div>Please let me know the reason or some tips.</div>
<div> </div>
<div>Thanks.</div>
<div> </div>
<p> </p>
</div>
<img height="1" width="1" alt="" />  <br />
_______________________________________________<br />
gdal-dev mailing list<br />
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br />
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br />
</blockquote></div>
<br />
<br clear="all" />
<br />
-- <br />
---------------------------------------+--------------------------------------<br />
I set the clouds in motion - turn up    | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br />
light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br />
and watch the world go round - Rush      | Geospatial Software Developer</div>
</blockquote>
<p class="fcknormal" style="font-family:¸¼Àº °íµñ; font-size:10pt"> </p>
</div>
<img src="http://mail.pixoneer.co.kr/mail/mail_confirm.php?host=pixoneer.co.kr&id=salim&sid=13838698480097867002&rcptto=gdal-dev%40lists.osgeo.org" width="1" height="1" alt="" /></p>
<p class="fcknormal" style="font-family:¸¼Àº °íµñ; font-size:10pt"> </p>
</body>
</html>

<img src="http://mail.pixoneer.co.kr/mail/mail_confirm.php?host=pixoneer.co.kr&id=salim&sid=13849929530579885001&rcptto=gdal-dev%40lists.osgeo.org" width="1" height="1">