Keywords: How to trick the compiler?

Adam D. Ruppe destructionator at gmail.com
Tue Jan 28 06:31:52 PST 2014


On Tuesday, 28 January 2014 at 11:22:10 UTC, Chris wrote:
> Is there a simple way to trick the compiler (e.g. with alias), 
> if a keyword conflicts with a function/method, e.g. as in a 
> HTML document:

alas, no. In my dom.d, I called that method "mainBody" instead...

If you are accessing a C function called body, you can access it 
using pragma mangle:

pragma(mangle, "body")
void cBody() { }


Still can't call it "body" in D, so have to add something, but 
the pragma mangle will make the name match up for the linker so 
it refers to the same C function.


More information about the Digitalmars-d-learn mailing list