Skip to content

hostent structure in win2_32 lib #40

@GCuser99

Description

@GCuser99

The docs say h_addrtype is a SHORT, but the WinDevLib type is specified as a Long (enum ADDRESS_FAMILIES).

In WinDevLib v9.1.591.0:

    Public Type hostent
        h_name As LongPtr /* official name of host */
        h_aliases As LongPtr /* alias list */
        h_addrtype As ADDRESS_FAMILIES /* host address type */
        h_length As Integer /* length of address */
        h_addr_list As LongPtr /* list of addresses */
    End Type

But the mystery to me is to avoid a native exception (32-bit and 64-bit) in resolving a host address, I have to use this:

    Private Type hostent
        h_name As LongPtr /* official name of host */
        h_aliases As LongPtr /* alias list */
        #If win64 Then
        h_addrtype As ADDRESS_FAMILIES /* host address type */
        #Else
        h_addrtype As Integer  /* host address type */
        #End If
        h_length As Integer /* length of address */
        h_addr_list As LongPtr /* list of addresses */
    End Type

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions