How include header file?
H. S. Teoh
hsteoh at qfbox.info
Wed Sep 7 19:38:52 UTC 2022
On Wed, Sep 07, 2022 at 06:11:14PM +0000, Injeckt via Digitalmars-d-learn wrote:
> I need to include this Ws2tcpip.h header file to my project. How can I
> do this? It's all because I need inet_ntop function from this header
> file.
If that's the only function you need, you can just copy the declaration
of inet_ntop into your .d file and mark it as extern(C). E.g., on my OS
it's declared as:
const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size);
Convert it to D:
extern(C) const(char)* inet_ntop(int af, const(void)* src, char* dst, socklen_t size);
You probably also need:
alias socklen_t = ...;
The definition can be found in your system header files. Probably you
can just get away with size_t.
T
--
The volume of a pizza of thickness a and radius z can be described by the following formula: pi zz a. -- Wouter Verhelst
More information about the Digitalmars-d-learn
mailing list