Skip to content

Commit

Permalink
Fixed compilation on Linux (re. the recent addition of @inlinable).
Browse files Browse the repository at this point in the history
Apparently on Linux you have to import CoreFoundation in order to _full_ access to things like `in_addr` which are otherwise part of Glibc… weird.
  • Loading branch information
wadetregaskis committed May 24, 2024
1 parent 97c966a commit 3e4fc6e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Sources/NetworkInterfaceInfo/IPv4Address.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#if canImport(Darwin)
import Darwin
#else
import CoreFoundation
import Glibc

// Annoyingly, /usr/include/netinet/in.h on Linux* is missing some constants. [* = It's assumed here that if Darwin isn't available we're running on Linux, where Glibc is]
let IN_CLASSD_NET = UInt32(0xf0000000)
let INADDR_CARP_GROUP = UInt32(0xe0000012)
let IN_LINKLOCALNETNUM = UInt32(0xa9fe0000) // This one at least makes sense - it _is_ an Apple-specific one.
let INADDR_ALLRPTS_GROUP = UInt32(0xe0000016)
let INADDR_PFSYNC_GROUP = UInt32(0xe00000f0)
let INADDR_ALLMDNS_GROUP = UInt32(0xe00000fb)
@usableFromInline let IN_CLASSD_NET = UInt32(0xf0000000)
@usableFromInline let INADDR_CARP_GROUP = UInt32(0xe0000012)
@usableFromInline let IN_LINKLOCALNETNUM = UInt32(0xa9fe0000) // This one at least makes sense - it _is_ an Apple-specific one.
@usableFromInline let INADDR_ALLRPTS_GROUP = UInt32(0xe0000016)
@usableFromInline let INADDR_PFSYNC_GROUP = UInt32(0xe00000f0)
@usableFromInline let INADDR_ALLMDNS_GROUP = UInt32(0xe00000fb)
#endif

import Foundation
Expand Down

0 comments on commit 3e4fc6e

Please sign in to comment.