SE-0495: C-compatible functions and enums

Hello,

In the ABI section, this proposal says that a @c function would produce the same entry points that @_cdecl does:

Updating existing @_cdecl to @objc or @c is ABI stable.

That's not what we want: @_cdecl actual produces two entry points: one with Swift's calling convention that's called by Swift clients, and a C-compatible "thunk" that's called by C clients. We consider that a mistake: a @c function should emit a single, C-compatible entrypoint and all clients should go through it. That makes the ABI surface area smaller and more predictable, as well as exactly matching what would happen if the function were implemented in C directly. This goes both for @c and @c @implementation.

Doug

9 Likes