Skip to content
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

[SR-6969] Support apinotes for revising C APIs #4838

Open
Lukasa opened this issue Feb 9, 2018 · 7 comments
Open

[SR-6969] Support apinotes for revising C APIs #4838

Lukasa opened this issue Feb 9, 2018 · 7 comments

Comments

@Lukasa
Copy link
Contributor

Lukasa commented Feb 9, 2018

Previous ID SR-6969
Radar rdar://problem/37391693
Original Reporter @Lukasa
Type New Feature
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels New Feature
Assignee None
Priority Medium

md5: 72f523b6a8075ff7c85272f077074b1f

Issue Description:

Occasionally when wrapping third-party C APIs it would be convenient to convince Swift to hide or differently expose the types in the underlying library. The Swift standard library does this by using apinotes, and while it is possible to create your own these are system-specific and SwiftPM does not provide any tools for distributing them.

It would be extremely convenient if SwiftPM came up with a way to support this use-case in a productised way.

@ddunbar
Copy link
Member

ddunbar commented Feb 9, 2018

@swift-ci create

@ankitspd
Copy link
Member

ankitspd commented Feb 9, 2018

What does Swift compiler expect here? If its only -I, this should already work if you place the apinote file in include/ directory of a C target. /cc @belkadan

@belkadan
Copy link

belkadan commented Feb 9, 2018

The API notes go next to the module map defining the module for a non-framework target. That seems perfectly compatible with C targets today, but I don't know if we actually have it all set up to work.

@ankitspd
Copy link
Member

Thanks Jordan. I tested this and it already works. Attached a sample package to this JIRA.

@ddunbar
Copy link
Member

ddunbar commented Feb 10, 2018

Awesome, thanks @aciidb0mb3r @belkadan

@swift-ci
Copy link
Contributor

Comment by Ryan Lovelett (JIRA)

I'm not sure this is 100% working. At least not with Swift 4.2.

If you use the attached potato.zip project and do swift package generate-xcodeproj --enable-code-coverage the resulting project cannot be compiled in Xcode.

You get a error/fixit saying:

Use of unresolved identifier 'howManyPotatoes'; did you mean 'how_many_potatoes'?

Beyond that I still don't know how this would work when using a System Library target.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
@rauhul
Copy link
Contributor

rauhul commented Nov 22, 2022

This does not work using the sample attached when using:

swift-driver version: 1.59 Apple Swift version 5.7 (swiftlang-5.7.0.118.4 clang-1400.0.27)
Target: arm64-apple-macosx13.0

@rauhul rauhul reopened this Nov 22, 2022
@rauhul rauhul added the bug label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants