<div dir="ltr">Hi Michael,<div><br></div><div>The attachment is the packages I created for testing purpose.</div><div>You can check it.</div><div><br></div><div>Thanks for the help,</div><div><br></div><div>Yang</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-12-30 18:15 GMT-06:00 Michael Gottesman <span dir="ltr">&lt;<a href="mailto:mgottesman@apple.com" target="_blank">mgottesman@apple.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you create a quick tarball of the swiftpm project. Would expedite the answering of the question.<br>
<br>
Michael<br>
<div><div class="h5"><br>
&gt; On Dec 30, 2016, at 11:17 AM, Yang Yang via swift-users &lt;<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I try to wrap a c library in swift package named Test.<br>
&gt; The code looks like this:<br>
&gt;<br>
&gt; Test1.h<br>
&gt;<br>
&gt; struct MyParams {<br>
&gt;       int (*func)();<br>
&gt; };<br>
&gt;<br>
&gt; typedef struct MyParams MyParams;<br>
&gt;<br>
&gt; Test2.h<br>
&gt; #include &quot;Test1.h&quot;<br>
&gt;<br>
&gt; static int test(){<br>
&gt;   return 0;<br>
&gt; }<br>
&gt;<br>
&gt; void myTest()<br>
&gt; {<br>
&gt;       MyParams params;<br>
&gt;       params.func = test;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; Then I try to import the package into swift code and use<br>
&gt; in Test.swift.<br>
&gt; ************************<br>
&gt; import Test<br>
&gt;<br>
&gt; class TestSwift {<br>
&gt;   func runtest(){<br>
&gt;     myTest()<br>
&gt;   }<br>
&gt; }<br>
&gt;<br>
&gt; However, the compiler report link error:<br>
&gt; function myTest: error: undefined reference to &#39;test&#39;<br>
&gt;<br>
&gt; If I comment out<br>
&gt; &quot;params.func = test;&quot; in myTest.<br>
&gt;<br>
&gt; It successfully build. How should I handle this situation?<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Yang<br>
</div></div>&gt; ______________________________<wbr>_________________<br>
&gt; swift-users mailing list<br>
&gt; <a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
<br>
</blockquote></div><br></div>