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
Now that we're bundling clang in snapshot toolchains we should be able to pass -fcf-runtime-abi=swift as well as -I/path/to/usr/lib/swift to clang. This will allow C targets to include CoreFoundation headers and participate in bridging. This is already possible if these flags are passed in, but I don't see why SwiftPM shouldn't pass them automatically.
Example:
root@bacccc9eabda:/test-package# PATH=/swift-DEVELOPMENT-SNAPSHOT-2019-02-26-a-ubuntu16.04/usr/bin:$PATH swift test -Xcc -fcf-runtime-abi=swift-5.0 -Xcc -I/swift-DEVELOPMENT-SNAPSHOT-2019-02-26-a-ubuntu16.04/usr/lib/swift
[5/5] Linking ./.build/x86_64-unknown-linux/debug/test-packagePackageTests.xctest
Test Suite 'All tests' started at 2019-02-28 17:20:56.427
Test Suite 'debug.xctest' started at 2019-02-28 17:20:56.428
Test Suite 'test_packageTests' started at 2019-02-28 17:20:56.429
Test Case 'test_packageTests.testExample' started at 2019-02-28 17:20:56.429
test a cfstr
Test Case 'test_packageTests.testExample' passed (0.0 seconds)
Test Suite 'test_packageTests' passed at 2019-02-28 17:20:56.429
Executed 1 test, with 0 failures (0 unexpected) in 0.0 (0.0) seconds
Test Suite 'debug.xctest' passed at 2019-02-28 17:20:56.429
Executed 1 test, with 0 failures (0 unexpected) in 0.0 (0.0) seconds
Test Suite 'All tests' passed at 2019-02-28 17:20:56.429
root@bacccc9eabda:/test-package# cat Sources/CLibTest/include/CLibTest.h
#include <CoreFoundation/CoreFoundation.h>
extern const _Nonnull CFStringRef kTestACFString;
root@bacccc9eabda:/test-package# cat Sources/CLibTest/CLibTest.c
#include <CLibTest.h>
#include <CoreFoundation/CoreFoundation.h>
const CFStringRef kTestACFString = CFSTR("test a cfstr");
root@bacccc9eabda:/test-package# cat Sources/test-package/test_package.swift
import Foundation
import CLibTest
struct test_package {
var text = "Hello, World!"
func test(string: String) {
print(string)
}
func test() {
test(string: kTestACFString as! String)
}
}
The text was updated successfully, but these errors were encountered:
@belkadan / @millenomi / @aciidb0mb3r I think we should just make the -Xcc -fcf-runtime-abi=swift-5.0 flag the default on Linux? I don't really see a reason to build with any other CF ABI setting.
Additional Detail from JIRA
md5: 41b6ca6e1389c95276c1020e607e53f5
Issue Description:
Now that we're bundling clang in snapshot toolchains we should be able to pass -fcf-runtime-abi=swift as well as -I/path/to/usr/lib/swift to clang. This will allow C targets to include CoreFoundation headers and participate in bridging. This is already possible if these flags are passed in, but I don't see why SwiftPM shouldn't pass them automatically.
Example:
The text was updated successfully, but these errors were encountered: