I have a C header file (it's a part of some SDK) and there is a typedef which depends on system architecture (whether 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;
}
The best way to quickly check your CPU architecture on Linux is by using the lscpu command. The utility is installed by default on all Linux distros.
version(X86)
{
// 32-bit
}
else
version(X86_64)
{
// 64-bit
}
else
{
// none of the above
}
Source: http://digitalmars.com/d/2.0/version.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With