<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 4, 2017, at 4:57 PM, Geordie Jay <<a href="mailto:geojay@gmail.com" class="">geojay@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Great, thanks for reminding me of this feature. I couldn't see how it could be used outside of the stdlib though, is it possible to use apinotes when simply linking a C module via its modulemap ?<br class=""></div></blockquote><div><br class=""></div>You can put</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span><modulename>.apinotes</div><div><br class=""></div><div>into the same directory as the module map.</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><div dir="ltr" class="">Douglas Gregor <<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>> schrieb am Fr. 5. Mai 2017 um 01:55:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 3, 2017, at 4:10 PM, Geordie J via swift-users <<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>> wrote:</div><br class="m_-6086971169769132268Apple-interchange-newline"><div class=""><div class="">Hi everyone,<br class=""><br class="">I’m about to start on another big project with Swift on Android and would like to annotate that JNI headers as much as possible before I do: specifically I’d like to make _Nonnull and CF_SWIFT_NAME annotations to the headers found in a user's jni.h.<br class=""><br class="">The question is: is it possible to annotate headers this without changing the original header files? Specifically I’m looking for an options that allows annotations in a separate file, probably one that is read when loading the package’s module.modulemap.<br class=""><br class="">I’d like to distribute the annotations in a SwiftPM package that also exposes the original (hopefully annotated) headers. Up until now I’ve been using Swift to override methods in code, but this isn’t as clean or extensible and I fear it may have other (particularly performance) implications.<br class=""><br class="">I guess the alternative would be to just maintain and distribute a modified version of jni.h with the annotations, but that would be a "last resort” option.<br class=""></div></div></blockquote></div><br class=""><div class=""><br class=""></div></div><div style="word-wrap:break-word" class=""><div class="">This is the role of API notes, which you can see here:</div><div class=""><br class=""></div><div class=""><span class="m_-6086971169769132268Apple-tab-span" style="white-space:pre-wrap">        </span><a href="https://github.com/apple/swift/tree/master/apinotes" target="_blank" class="">https://github.com/apple/swift/tree/master/apinotes</a></div><div class=""><br class=""></div><div class="">with some rough documentation-in-source here:</div><div class=""><br class=""></div><div class=""><span class="m_-6086971169769132268Apple-tab-span" style="white-space:pre-wrap">        </span><a href="https://github.com/apple/swift-clang/blob/stable/lib/APINotes/APINotesYAMLCompiler.cpp" target="_blank" class="">https://github.com/apple/swift-clang/blob/stable/lib/APINotes/APINotesYAMLCompiler.cpp</a></div><div class=""><br class=""></div><div class=""><span class="m_-6086971169769132268Apple-tab-span" style="white-space:pre-wrap">        </span>- Doug</div><div class=""><br class=""></div></div></blockquote></div>
</div></blockquote></div><br class=""></body></html>