link to C function whose name is a D keyword

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 6 07:42:34 PST 2016


On Wednesday, 6 January 2016 at 15:41:27 UTC, Carl Sturtivant 
wrote:
> //D that doesn't work:
> extern(C) int try(int x);

Try:

pragma(mangle, "try")
extern(C) int try_(int x);

then call it with the udnerscore in D, the linker should tie it 
up thanks to the pragma.


More information about the Digitalmars-d-learn mailing list