digitalmars.D.learn - How to convert C macro to D? Thanks.
- FrankLike (11/11) Feb 24 2018 Hi,everyone,
- Adam D. Ruppe (5/8) Feb 24 2018 neither. those are little functions.
- FrankLike (10/16) Feb 24 2018 Sorry.
Hi,everyone, I can convert some simple C macros, but a bit more complicated will need your help. For example: #define _NDIS_CONTROL_CODE(request,method) \ CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) #define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT) use alias or enum,how to do? Thanks.
Feb 24 2018
On Saturday, 24 February 2018 at 13:50:16 UTC, FrankLike wrote:#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT) use alias or enum,how to do?neither. those are little functions. auto IOCTL_NDIS_QUERY_GLOBAL_STATS () { return _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT); }
Feb 24 2018
On Saturday, 24 February 2018 at 13:57:27 UTC, Adam D. Ruppe wrote:On Saturday, 24 February 2018 at 13:50:16 UTC, FrankLike wrote:#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT)auto IOCTL_NDIS_QUERY_GLOBAL_STATS () { return _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT); }Sorry. I look for 'IOCTL_DISK_GET_DRIVE_GEOMETRY' in core.sys.windows.winioctl.d,then I know : enum :DWORD IOCTL_NDIS_QUERY_GLOBAL_STATS = CTL_CODE_T!(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS); It's ok. Thank you.
Feb 24 2018