d如何包含头文件
原文
因为需要inet_ntop函数,我要包含Ws2tcpip.h头文件.
要复制
const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size);
声明为D:
extern(C) const(char)* inet_ntop(int af, const(void)* src, char* dst, socklen_t size);
还需要:
alias socklen_t = ...;
该定义可在系统头文件中找到.也许可以摆脱size_t.
在Windows上,它可能具有基于字符宽度的不同版本.
win32接口需要extern(Windows).
alias socklen_t = int
这是链接错误,你需要链接至ws2_32.lib库.
浙公网安备 33010602011771号