Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Support compiling against Musl #71

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/Backtrace/Backtrace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ public enum Backtrace {

#elseif os(Linux)
import CBacktrace
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#else
#error("Unsupported runtime")
#endif

typealias CBacktraceErrorCallback = @convention(c) (_ data: UnsafeMutableRawPointer?, _ msg: UnsafePointer<CChar>?, _ errnum: CInt) -> Void
typealias CBacktraceFullCallback = @convention(c) (_ data: UnsafeMutableRawPointer?, _ pc: UInt, _ filename: UnsafePointer<CChar>?, _ lineno: CInt, _ function: UnsafePointer<CChar>?) -> CInt
Expand Down
6 changes: 6 additions & 0 deletions Sources/Backtrace/Demangle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
//===----------------------------------------------------------------------===//

#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#else
#error("Unsupported runtime")
#endif
#elseif os(Windows)
#if swift(<5.4)
#error("unsupported Swift version")
Expand Down
6 changes: 6 additions & 0 deletions Sources/Sample/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ import Backtrace
#if canImport(Darwin)
import Darwin
#elseif os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#else
#error("Unsupported runtime")
#endif
#endif

#if swift(<5.9) || os(Windows)
Expand Down