<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 24, 2016, at 6:03 PM, Stephen Celis via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Thanks for following up :)</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 24, 2016, at 8:46 PM, Fabio Kaminski &lt;<a href="mailto:fabiokaminski@gmail.com" class="">fabiokaminski@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">1 - For me at least the "link" directive works only for shared libs,<br class="">and given you are looking into the symbols of the .a file and not the<br class="">.dylib or .so, that its probably what the modulemap will try to link<br class="">against?</div></div></blockquote><div class=""><br class=""></div><div class="">Ah, interesting! Is there a reason for this limitation? Could a bug be filed for a swiftpm enhancement that automatically adds `-l` flags for whatever is included as a `link` in the module map?</div></div></div></div></blockquote><div><br class=""></div><div>This is a limitation of module maps, so any improvement would have to go into clang.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class=""><div class="">I think the [extern_c] directive maybe is the magic sauce that will<br class="">try to link the symbols using the correct mangling technique "_" ?<br class=""></div></blockquote><div class=""><br class=""></div><div class="">Unfortunately [extern_c] doesn't seem to have any effect on linking, though it appears to be the correct attribute according to <a href="http://clang.llvm.org/docs/Modules.html#module-declaration" class="">http://clang.llvm.org/docs/Modules.html#module-declaration</a>. I was able to fix the problem, though, with this Makefile in my dependent project:</div><div class=""><br class=""></div><div class=""><a href="https://gist.github.com/stephencelis/7f76f8d26a1df64ee3ff#file-llvm_makefile-mak" class="">https://gist.github.com/stephencelis/7f76f8d26a1df64ee3ff#file-llvm_makefile-mak</a></div><div class=""><br class=""></div><div class="">It's an unfortunate limitation. Requiring dependent projects to set certain `-Xcc` and `-Xlinker` flags makes the parent CLLVM dependency a lot less easy to use. I'm not sure if there have been evolution, bug, or internal discussions around this, though. At least I'm unblocked in the meantime. Thanks again!</div></div></div></blockquote><br class=""></div><div>-Xcc/-Xlinker are strictly work-ardoun methods so that people can make progress with swift build until we have real solutions.</div><div><br class=""></div><div>Watch for my proposal to improve module map support coming to swift-evolution at some point.</div><br class=""></body></html>