<div dir="ltr">I try to wrap a c library in swift package named Test.<div>The code looks like this:</div><div><br></div><div>Test1.h</div><div><br></div><div><div>struct MyParams {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>int (*func)();</div><div>};</div><div><br></div><div>typedef struct MyParams MyParams;</div></div><div><br></div><div>Test2.h</div><div><div>#include &quot;Test1.h&quot;</div><div><br></div><div>static int test(){</div><div>  return 0;</div><div>}</div><div><br></div><div>void myTest()</div><div>{</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>MyParams params;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>params.func = test;</div><div>}</div></div><div><br></div><div><br></div><div>Then I try to import the package into swift code and use</div><div>in Test.swift.</div><div>************************</div><div>import Test</div><div><br></div><div><div>class TestSwift {</div><div>  func runtest(){</div><div>    myTest()</div><div>  }</div><div>}</div></div><div><br></div><div>However, the compiler report link error:</div><div><div>function myTest: error: undefined reference to &#39;test&#39;</div></div><div><br></div><div>If I comment out </div><div>&quot;params.func = test;&quot; in myTest.<br></div><div><br></div><div>It successfully build. How should I handle this situation?</div><div><br></div><div>Thanks,</div><div><br></div><div>Yang</div></div>