extern(C) vs. extern(Windows)

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sun Apr 1 13:22:38 PDT 2007


Frank Benoit (keinfarbton) wrote:
> I have many functions. On linux they shall be extern(C), on win32 they
> shall be extern(Windows). How do I do that?

Put this right above them:
---
version(Windows) {
     extern(Windows):
} else {
     extern(C):
}
---
(assuming extern(C) for anything but Windows)

If any other functions follow them, add "extern(D):" afterwards to 
restore the default calling convention and mangling.


More information about the Digitalmars-d-learn mailing list