Calypso and the future of D
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jan 26 00:59:33 PST 2015
On 1/26/2015 12:18 AM, Jacob Carlborg wrote:
> It works something like this:
>
> Given the C++ header file foo.h:
>
> void bar(unsigned *);
>
> and the C++ source file foo.cpp:
>
> void bar(unsigned *p) { }
>
> I want to call bar() from my D code in test.d:
>
> void main() {
> uint x;
> bar(&x);
> }
>
> Here's how to do it with Calypso:
>
> module test;
>
> modmap (C++) "foo.h";
> import (C++) _ : bar;
>
> void main() {
> uint x;
> bar(&x);
> }
>
> To compile and link:
>
> clang++ foo.cpp -c
> ldc test.d foo.o
>
> Which generates the program 'test' which can be run.
>
> Calypso is not a separate tool. It's a fork of LDC which allows you to directly
> import/include a C++ header files and use the declarations from within D. No
> bindings or intermediate files are necessary.
Thank you. That really, really needs to go into the README.md, especially the
last paragraph.
More information about the Digitalmars-d
mailing list