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-15528] Can't convert DispatchQueue to dispatch_queue_t on Linux #602

Open
swift-ci opened this issue Nov 28, 2021 · 0 comments
Open

[SR-15528] Can't convert DispatchQueue to dispatch_queue_t on Linux #602

swift-ci opened this issue Nov 28, 2021 · 0 comments

Comments

@swift-ci
Copy link

@swift-ci swift-ci commented Nov 28, 2021

Previous ID SR-15528
Radar rdar://85783481
Original Reporter thomas (JIRA User)
Type Bug
Environment

MacOS

12.0.1 (21A559)
Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)
Target: x86_64-apple-macosx12.0

Linux:

Linux primary 5.4.0-90-generic #​101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal

Swift version 5.5.1 (swift-5.5.1-RELEASE)
Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
Votes 0
Component/s libdispatch, Standard Library
Labels Bug
Assignee None
Priority Medium

md5: a69653a3763608dc24b58bb1e336880c

Issue Description:

When calling a C API from Swift that takes a dispatch queue as argument, on Linux the type conversion fails.

Example. A C function that defines a function that takes a dispatch_queue_t as argument.

Code (run-me.c)
#include <dispatch/dispatch.h>
void sayHiOnQueue(dispatch_queue_t queue);

Code (run-me.swift):
import Foundation

let queue = DispatchQueue(label: "test")
sayHiOnQueue(queue)
Compiling via:
swiftc -import-objc-header run-me.h -emit-object -module-name runme run-me.swift

On macOS this works as expected. On Linux this fails with:

run-me.swift:4:14: error: cannot convert value of type 'DispatchQueue' to expected argument type 'dispatch_queue_t?' (aka 'Optional<OpaquePointer>')
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 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

1 participant