> On Dec 18, 2017, at 9:34 PM, Greg Parker <gpar...@apple.com> wrote: > > >> On Dec 13, 2017, at 10:28 PM, John McCall via swift-dev <swift-dev@swift.org >> <mailto:swift-dev@swift.org>> wrote: >> >>> On Dec 13, 2017, at 8:35 PM, Saleem Abdulrasool <compn...@compnerd.org >>> <mailto:compn...@compnerd.org>> wrote: >>> >>>> On Wed, Dec 13, 2017 at 4:14 PM, John McCall <rjmcc...@apple.com >>>> <mailto:rjmcc...@apple.com>> wrote: >> >>>> >>>> - SILGen may need to introduce thunks when passing around such functions >>>> as @convention(c) function values. Code for this already exists in order >>>> to allow C functions to be passed around as native function values. >>> >>> This sounds pretty good and would broaden the abilities for swift to FFI to >>> existing code. >> >> Yeah. This should work well as long as there isn't an API that needs to >> traffic in non-standard function *pointers*. > > 32-bit Windows needs to do that. Callback functions passed to the Windows API > via parameters or struct fields are often __stdcall but the default calling > convention is __cdecl.
Well, I should've guessed. Fortunately, I don't think we're closing out the possibility of supporting multiple calling conventions in the user-facing type system in the future. We can still import C function declarations without a @convention because a global function can be coerced to an arbitrary CC. Technically, I guess you could argue that there ought to be a preference in the constraint-solver for matching a function declaration with its actual CC, but that's a minor enough source-compatibility problem (overloading based on the @convention of an argument function?) that I feel comfortable ignoring it for now, especially since we don't implement that today. John.
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev