[swift-users] Binding Regular C Functions (Gtk, Cairo, etc.)

Gage Morgan gagemorgan at outlook.com
Tue Dec 8 13:47:58 CST 2015


Awesome. So no technical binding here. Will test soon. Cheers,
--MGage--

Sent from Outlook Mobile




On Tue, Dec 8, 2015 at 9:01 AM -0800, "Jens Alfke" <jens at mooseyard.com> wrote:






> On Dec 7, 2015, at 7:39 PM, Gage Morgan via swift-users <swift-users at swift.org> wrote:
>
> 1) Map the cairo.h file to a system module named CCairo
> 2) Include that in a file
> 3) Convert any functions you've entered in C into a Swift format, no binding "workarounds" necessary like other languages,

Yes. Swift understands that this is a C function, and follows C calling conventions in the machine code that implements the call, so there’s no glue code necessary.

(That is, this is like C++’s `extern “C”`, not like SWIG.)

—Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151208/5a90c865/attachment.html>


More information about the swift-users mailing list