Description
Previous ID | SR-1119 |
Radar | None |
Original Reporter | @belkadan |
Type | Bug |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Standard Library |
Labels | Bug, StarterBug |
Assignee | @CodaFi |
Priority | Medium |
md5: 0f34c53480ec273df4a5db445681eff4
Issue Description:
If you have a Swift library that's loaded into a non-Swift executable, or a mixed-source executable whose main
function isn't generated from Swift, we never get the chance to set argc
and argv
on Process, resulting in traps when a client attempts to access them. We should give up on using the "real" argc and argv (i.e. the ones passed to main) and just use _NSGetArgv()
on Darwin, /proc/(pid)/cmdline
on Linux, and whatever the appropriate API is on FreeBSD, initializing the arguments lazily (and independently from main
.
(Alternately, we could put a static initializer in the Swift standard library, at least on Darwin platforms. But static initializers are evil incur a runtime cost on every client, so that's not a great answer.)