[swift-users] Binding Regular C Functions (Gtk, Cairo, etc.)
jens at mooseyard.com
Tue Dec 8 11:01:56 CST 2015
> 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.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users