Skip to content

ClangImporter: make bridging header portable #20707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2019

Conversation

compnerd
Copy link
Member

Using #import is confusing when used on Windows targets as it is
treated as a type library import. Use #include instead. This should
have no impact on other targets.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - db596f4fe7e833aca284e34a775ec7b65165b92b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - db596f4fe7e833aca284e34a775ec7b65165b92b

@compnerd
Copy link
Member Author

compnerd commented Jan 2, 2019

@jrose-apple - created a thread at https://forums.swift.org/t/clangimporter-including-files/19119 to deal with this, as I'm not sure if this is sufficient to just change to a #include.

@compnerd compnerd force-pushed the import-bridging-header branch from db596f4 to e1ec85e Compare January 17, 2019 00:13
@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - db596f4fe7e833aca284e34a775ec7b65165b92b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - db596f4fe7e833aca284e34a775ec7b65165b92b

`#import` on Windows is problematic at as the default behaviour in C/C++
mode is to be an import of a type library (COM feature).  This can be
adjusted by always enabling Objective-C interop on Windows, but the
runtime is not always built with ObjC interop.

Unfortunately, always using `#include` breaks semantics on Apple where
some places rely on the include-once semantics of `#import`.

For now, control the inclusion technique to be based on whether ObjC
interop is enabled or not.
@compnerd compnerd force-pushed the import-bridging-header branch from e1ec85e to 052c89d Compare January 17, 2019 21:57
@compnerd
Copy link
Member Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit 532c006 into swiftlang:master Jan 18, 2019
@compnerd compnerd deleted the import-bridging-header branch January 18, 2019 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants