Thread overview | |||||
---|---|---|---|---|---|
|
February 24, 2018 How to convert C macro to D? Thanks. | ||||
---|---|---|---|---|
| ||||
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. |
February 24, 2018 Re: How to convert C macro to D? Thanks. | ||||
---|---|---|---|---|
| ||||
Posted in reply to FrankLike | 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);
}
|
February 24, 2018 Re: How to convert C macro to D? Thanks. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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. |
Copyright © 1999-2021 by the D Language Foundation