[swift-corelibs-dev] libdispatch import order / nondeterminism

Daniel Dunbar daniel_dunbar at apple.com
Wed Feb 10 22:39:18 CST 2016

I don't have the full context here, but...

For C and regular header include style, it works roughly the same on linux, except that we don't have all the modules declared in one level. However:

  #include <dispatch/dispatch.h>

will cause the compiler to look inside the dispatch subdirectory, at which point it should seem the module map file and then load dispatch as a module.

However, this doesn't work for Swift because Swift doesn't go through the header search path, it goes through the "module search" path (like @import foo in Obj-C). For that to work, Clang will need to know to preload the module map file in order to understand how to map dispatch. Clang has `-fmodule-map-file=<path>` to cause Clang to scan (not necessarily load) a module map in advance.

 - Daniel

> On Feb 10, 2016, at 8:31 PM, Daniel A. Steffen via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> having -I /usr/local/include/dispatch doesn’t seem right to me, the C header include convention is all <dispatch/*.h> so the dispatch/ directory itself should not be part of the search path. 
> maybe that means that something different needs to happen to pick up the module files (AFAIK on Darwin this works differently by having a toplevel modulefile in /usr/include that references the submodules, I don’t know how modules are intended to work on other platforms)
> Daniel
>> On Feb 10, 2016, at 18:09, Drew Crawford via swift-corelibs-dev <swift-corelibs-dev at swift.org <mailto:swift-corelibs-dev at swift.org>> wrote:
>>> On Feb 10, 2016, at 8:08 PM, Philippe Hausler <phausler at apple.com <mailto:phausler at apple.com>> wrote:
>>> The -I/usr/local/include/dispatch probably sees time.h in there and thinks that is part of a system root header? Just a speculation.
>> I agree 100%, but I don't know how to fix it.
>> _______________________________________________
>> swift-corelibs-dev mailing list
>> swift-corelibs-dev at swift.org <mailto:swift-corelibs-dev at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160210/b4fa8458/attachment.html>

More information about the swift-corelibs-dev mailing list