<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 18, 2017, at 9:34 PM, Greg Parker <<a href="mailto:gparker@apple.com" class="">gparker@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 13, 2017, at 10:28 PM, John McCall via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 13, 2017, at 8:35 PM, Saleem Abdulrasool <<a href="mailto:compnerd@compnerd.org" class="">compnerd@compnerd.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><blockquote type="cite" class="">On Wed, Dec 13, 2017 at 4:14 PM, John McCall <span dir="ltr" class=""><<a href="mailto:rjmccall@apple.com" target="_blank" class="">rjmccall@apple.com</a>></span> wrote:<br class=""></blockquote><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""></div></blockquote></div></div></div></div></blockquote></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote type="cite" class=""><br class=""></blockquote><div class=""><blockquote type="cite" class=""> - 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.</blockquote></div></div></div></div></blockquote></div></div></div></blockquote><blockquote type="cite" class=""><blockquote type="cite" class=""><br class=""></blockquote></blockquote><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">This sounds pretty good and would broaden the abilities for swift to FFI to existing code.</div></div></div></div></blockquote><div class=""><br class=""></div>Yeah. This should work well as long as there isn't an API that needs to traffic in non-standard function *pointers*.</div></div></div></blockquote><br class=""></div><div class="">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.</div></div></div></blockquote><div><br class=""></div>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.</div><div><br class=""></div><div>John.</div></body></html>