Skip to content

Support @_silgen_name C imports for SE-0324 #68332

Open
@glessard

Description

@glessard

In standard library modules, many C functions are imported using the following pattern:

@_silgen_name("_swift_stdlib_getUnsafeArgvArgc")
internal func _swift_stdlib_getUnsafeArgvArgc(_: UnsafeMutablePointer<Int32>)
  -> UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>

not followed by a function body. This is special-cased by the compiler.

Functions imported this way do not benefit from the SE-0324 relaxed pointer semantics. They should have the same affordance as other C functions. This pattern also appears with the @objc attribute, but much more rarely than with @_silgen_name.

Tracked as rdar://114794258

Metadata

Metadata

Assignees

No one assigned

    Labels

    @_silgen_nameFeature → attributes: The @_silgen_name attributeattributesFeature: Declaration and type attributesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c interopFeature: Interoperability with CcompilerThe Swift compiler itselfunexpected behaviorBug: Unexpected behavior or incorrect output

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions