-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Objective-C/C++ module cannot depend on a Swift module #7099
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
Comments
That's right, we don't give direct access to the header. The expectation is that one would import the module instead, e.g. |
None of the following works in C++, I can get away with // These ones are the ones I expected to work but didn't
#import <MySwiftModule>
#include <MySwiftModule/MySwiftModule-Swift.h>
// These ones are desperate attempts
#include <MySwiftModule.h>
#include <MySwiftModule-Swift.h>
#include <MySwiftModule/MySwiftModule.h>
#import <MySwiftModule.h>
#import <MySwiftModule-Swift.h>
#import <MySwiftModule/MySwiftModule.h>
#import <MySwiftModule/MySwiftModule-Swift.h> My next step is figuring out how to include system library headers in C++, trying to access |
@hyp @neonichu Using Is there something I can do in the mean time (ideally with the Swift 5.10 toolchain) to work around this issue? |
So SPM was designed to not allow importing of swift code into ObjCxx source? A pretty surprising limitation. |
Hi @MaxDesiatov, I believe I ran into this in #5919 and was able to get things working then by passing Being able to import a generated header into a |
We're in the middle of transitioning away from SwiftPM's native build system to the recently opened Swift Build which I believe does a better job of this. |
Description
I have a Swift module with classes marked
@objc
and I'm trying to migrate our C++ library, which depends on the previous module, to build using the Swift Package Manager.This is possible with Xcode projects and we can access them via the following line.
#include <MySwiftModule/MySwiftModule-Swift.h>
Using swiftpm however this header doesn't seem to exist.
Expected behavior
I'd expect to have access to the generated bridging header in our C++ library.
Actual behavior
There doesn't seem to be any generated bridging headers to import.
Steps to reproduce
With the following package, try to
#import <SwiftTarget/SwiftTarget-Swift.h>
, it doesn't exist nor does it exist anywhere else.Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: