On 2015-04-12 11:19, Suliman wrote:
So I got GDAL binding work. And now I need to understand how to
translate C code to D.

Here is simple tutorial: http://www.gdal.org/gdal_tutorial.html If I
right understand it's easier to take C, than C++ code example.

Now I am trying to get very simple example work. My code is:

   string fileTiff =
`D:\code\RSM2DOC\data-example\03022014_101_022731_09_10_Rostov.tif`;
   if (!fileTiff.exists)
     writeln("Tiff file do not exists");

   GDALDatasetH hDataset = GDALOpen( toStringz(fileTiff),
GDALAccess.GA_ReadOnly );

   GDALDriverH  hDriver;
   hDriver = GDALGetDatasetDriver(hDataset);

   double adfGeoTransform[6];

   if( GDALGetGeoTransform( hDataset, adfGeoTransform ) == CE_None )
   {
     writeln(adfGeoTransform[1]);
   }


function (void*, double*) is not callable using argument types (void*,
double[6])

I can't understand why this error is rise up. It's look like 1-to-1 with
C code.

Also I can't understand at what moment adfGeoTransform get in it value.

GDALGetGeoTransform is declared to take a pointer to a double (array of doubles). While adfGeoTransform is declared as a static array [1] of doubles. Static arrays are stack allocated and passed by value, the function expects an array which is passed by reference. Try adding ".ptr" to "adfGeoTransform" in the call to GDALGetGeoTransform.

[1] http://dlang.org/arrays.html#static-arrays

--
/Jacob Carlborg

Reply via email to