Calypso: Direct and full interfacing to C++
CraigDillabaugh via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue May 19 10:44:37 PDT 2015
On Tuesday, 19 May 2015 at 17:31:07 UTC, Kelly wrote:
> On Tuesday, 19 May 2015 at 16:33:00 UTC, CraigDillabaugh wrote:
>> On Tuesday, 19 May 2015 at 08:09:33 UTC, Suliman wrote:
>>> modmap (C++) "<gdalwarper>";
>>>
>>> import std.stdio;
>>>
>>> void main()
>>> {
>>> GDALDatasetH hSrcDS, hDstDS;
>>> GDALAllRegister();
>>> writeln("hello");
>>> }
>>>
>>>
>>> error:
>>> app.d(7): Error: undefined identifier GDALDatasetH
>>> app.d(7): Error: undefined identifier GDALDatasetH
>>> app.d(8): Error: undefined identifier GDALAllRegister
>>
>> Perhaps you also need to include the GDAL headers, as I
>> suspect gdalwarper doesn't define GDALDatasetH.
>
>
> Hi Craig,
>
> The method here is to actually 'import (C++) _;' since that '_'
> will make Calypso import all the global
> functions/variables/typedefs in gdalwarper.
>
> This works for namespaces also, so if you have a namespace in a
> different example called MySpace, then calling 'import (C++)
> MySpace._;' will import all the functions/variables/typedefs in
> the namespace and make them accessible in your D file.
>
> If you just have a single class in the MySpace namespace called
> 'myclass', and you would like to use it in your D program, then
> use 'import (C++) MySpace.myclass;' to import it. Then
> instantiate the class in D and use it from there.
>
> Thanks,
> Kelly
Kelly,
Just to clarify then. If gdalwarper.h includes gdal.h and
GDALDatasetH is declared in gdal.h, then gdal.h gets imported too?
Craig
More information about the Digitalmars-d-announce
mailing list