You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dispatch: split DISPATCH_EXPORT and prepare for static linking
This change accomplishes two items:
1. splits out a new `DISPATCH_EXTERN` macro to decorate with `extern` or
`extern "C"` based on the compilation mode (C vs C++).
2. enables a new configuration macro (`dispatch_STATIC`) that allows
building with libdispatch for static linking. The default remains
dynamic linking.
The motivation for `DISPATCH_EXTERN` is primarily being able to
concisely define `DISPATCH_EXPORT`. This follows the naming scheme that
most other Apple frameworks use (e.g. UIKit, Foundation, etc).
The change to introduce support for static linking is motivated by
Windows. With the gradual roll out of static linking of the runtime, it
would be convenient to be able to statically link dispatch into a fully
sealed Swift program. Doing so requires building libdispatch without the
`__declspec(dllexport)` and `__declspec(dllimport)` attributes on
Windows. Similarly, it would be unfortunate to have dispatch's ABI be
subsumed by a client library and have it participate in dynamic linking.
The user is responsible for defining `dispatch_STATIC` when using a
static copy of libdispatch. This allows the default to remain dynamic
linking (which is the preferred style on Darwin and Windows).
0 commit comments