<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I have some c functions that I would like to import into a CROSS PLATFORM compatible Swift package. It’s only a function from each of these files (fcntl.h,&nbsp;unistd.h,&nbsp;sys/socket.h,&nbsp;netinet/in.h).<div class=""><br class=""></div><div class="">Is there a recommended way to do this?&nbsp;</div><div class=""><br class=""></div><div class="">I was thinking of something like:</div><div class="">Create my wrapper functions:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> swift_fcntl(<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> fildes, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> cmd, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> arg){</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> fcntl(fildes, cmd, arg);</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> swift_close(<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">int</span> fd){</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> close(fd);</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">uint16_t swift_htons(uint16_t portNum){</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> htons(portNum);</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Use a build script to build the library and copy it /usr/local/lib and /usr/local/include</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">Use the module map file to import the static lib</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div></body></html>