开发者

determine CPU architecture in D

I have a C header file (it's a part of some SDK) and there is a typedef which depends on system architecture (wheth开发者_如何学JAVAer it is 32 or 64-bit), how do I transfer it to my D module? Thanks.

Edit: OK, that was too simple and I've already find a solution... If someone interested, it is:

version(X86) {
  typedef int your_type;
}
version(X86_64) {
  typedef long your_type;
}


version(X86)
{
    // 32-bit
}
else
version(X86_64)
{
    // 64-bit
}
else
{
    // none of the above
}

Source: http://digitalmars.com/d/2.0/version.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜