[swift-dev] Preserving and Applying CC in Imported Decls

Greg Parker gparker at apple.com
Mon Dec 18 20:34:25 CST 2017


> On Dec 13, 2017, at 10:28 PM, John McCall via swift-dev <swift-dev at swift.org> wrote:
> 
>> On Dec 13, 2017, at 8:35 PM, Saleem Abdulrasool <compnerd at compnerd.org <mailto:compnerd at compnerd.org>> wrote:
>> 
>>> On Wed, Dec 13, 2017 at 4:14 PM, John McCall <rjmccall at apple.com <mailto:rjmccall at 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.


-- 
Greg Parker     gparker at apple.com     Runtime Wrangler


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20171218/13cb55f3/attachment.html>


More information about the swift-dev mailing list