<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>Okey, so I see what they're trying to say, but what about functions from C that actually take input? For example, in Cairo, cairo_move_to() would not make the cut on its own. Matter of fact, it would take a surface in the form of a pointer and an x and
 y value. So we would have&nbsp;</div>
<div><br>
</div>
<div>cairo_surface_t *cr</div>
<div>cairo_move_to(cr, x, y);</div>
<div><br>
</div>
<div>among countless others. Is Swift able to pull this out of thin air, or do we have to take each individual function and convert it to Swift ourselves? I guess what I'm asking is: Is Swift able to understand something like</div>
<div><br>
</div>
<div>import CCairo</div>
<div>func cairo_line_to: Void(let cairo_t = MutableUnsafePointer(cr), x: Double, y: Double)</div>
<div><br>
</div>
<div>after I include just a header file and map it? The function draws a line on a surface. Assuming the syntax is correct, then you're telling me the process is just:</div>
<div><br>
</div>
<div>1) Map the cairo.h file to a system module named CCairo</div>
<div>2) Include that in a file</div>
<div>3) Convert any functions you've entered in C into a Swift format, no binding &quot;workarounds&quot; necessary like other lagnguages, and</div>
<div>4) Swift recognizes you meant to use that function that is written specifically in C and is included in that header file mapped by CCairo. If Swift cannot automatically know that you meant to pull a function from a C header file, what must I do if it cannot?</div>
<div><br>
</div>
<div>I came here because I've read tutorials but am still confused on whether or not the CCairo module itself can just recognize a function without having to do more.&nbsp;<br>
<div class="acompli_signature"><br>
</div>
<div class="acompli_signature">Sent from <a href="http://aka.ms/Ox5hz3">Outlook</a></div>
<br>
</div>
<br>
<br>
<br>
<div class="gmail_quote">On Mon, Dec 7, 2015 at 6:49 PM -0800, &quot;Gage Morgan&quot; <span dir="ltr">
&lt;<a href="mailto:gagemorgan@outlook.com" target="_blank">gagemorgan@outlook.com</a>&gt;</span> wrote:<br>
<br>
</div>
<div>
<div id="x_compose" style="padding-left:20px; padding-right:20px; padding-bottom:8px">
<br>
<br>
</div>
<div class="x_gmail_quote">_____________________________<br>
From: Gage Morgan &lt;<a dir="ltr" href="mailto:gagemorgan@outlook.com">gagemorgan@outlook.com</a>&gt;<br>
Sent: Monday, December 7, 2015 9:40 PM<br>
Subject: Re: [swift-users] Binding Regular C Functions (Gtk, Cairo, etc.)<br>
To: Mish Awadah &lt;<a dir="ltr" href="mailto:mawadah@apple.com">mawadah@apple.com</a>&gt;<br>
<br>
<br>
<div>I read that. What I want to know is how to bind the functions themselves after creating a system package. How to use the c functions that got imported, if you will.&nbsp;
<br>
<br>
<div class="x_acompli_signature">Sent from <a href="http://aka.ms/Ox5hz3">Outlook</a>
</div>
<br>
</div>
<br>
<br>
<br>
<div class="x_gmail_quote">On Mon, Dec 7, 2015 at 6:39 PM -0800, &quot;Mish Awadah&quot; <span dir="ltr">
&lt;<a href="mailto:mawadah@apple.com">mawadah@apple.com</a>&gt;</span> wrote: <br>
<br>
</div>
<div class="" style="word-wrap:break-word">Please see the reference at&nbsp; <a href="https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md" class="">
https://github.com/apple/swift-package-manager/blob/master/Documentation/SystemModules.md</a>
<div class=""><br class="">
</div>
<div class="">- mish </div>
<div class=""><br class="">
<div>
<blockquote class="">
<div class="">On Dec 7, 2015, at 6:33 PM, Gage Morgan via swift-users &lt; <a href="mailto:swift-users@swift.org" class="">
swift-users@swift.org</a>&gt; wrote: </div>
<br class="x_x_Apple-interchange-newline">
<div class="">
<div class="">For any project: How is a C to Swift function binding created? I'd like to know how to import C functions to Swift. Once I can do this successfully, I'll be all set.&nbsp;
<br class="">
<br class="">
<div class="x_x_acompli_signature">Sent from <a href="http://aka.ms/Ox5hz3" class="">
Outlook</a> </div>
<br class="">
</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=xTF6JWnt2pl7kNka7081D3VajDoXFZTI5JEuSuQLncpUdQ-2Fw9ccP6Ms6ZCRWxxCNMvcjqMyXkU0xtEyNnPmbbGvau5P1qozRM4wtwri-2FpSE-2FEXZuvlDszaEHYzSaksD893r-2F0sy5YAMh13FZ-2FWZGIN1dOJKBHRj4RWzKT7VB4TiHfQz-2Bi3FZ5dWnGHOoMc8lIsDrxDgXNI1Bp2xBSGaIJ9Xt41Lsoi-2F7pvCk4eQUYxk-3D" alt="" width="1" height="1" border="0" class="" style="height:1px!important; width:1px!important; border-width:0!important; margin-top:0!important; margin-bottom:0!important; margin-right:0!important; margin-left:0!important; padding-top:0!important; padding-bottom:0!important; padding-right:0!important; padding-left:0!important">
 _______________________________________________ <br class="">
swift-users mailing list <br class="">
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a> <br class="">
<a dir="ltr" href="https://lists.swift.org/mailman/listinfo/swift-users">https://lists.swift.org/mailman/listinfo/swift-users</a>
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
<br>
<br>
</div>
</div>
</body>
</html>