[swift-users] Compiling C-usable objects/shared objects

Daniel Farina daniel at fdr.io
Mon Apr 11 13:36:27 CDT 2016


I've been playing with recent versions of Swift on Linux and think the
whole thing is rather neat. I'm most curious about how swift programs might
be embeddable in C projects.

I found a number of documentation artifacts about calling C functions and
providing Swift callbacks to C, but none about how to disable mangling of
symbols or doing whatever else was necessary to allow C programs to link a
Swift .o/.so.

Also ambiguous to me are runtime requirements, particularly in terms of
background threads and memory management. Many of the target C programs I
have their in mind have their own memory and concurrency management
strategies, e.g. extensions for Python, Ruby, Postgres...

Is this something that works? Or could be made to work? Has a lot of subtle
problems besides throwing "convention(c)" on some functions and turning off
mangling?

Thanks for considering my questions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160411/247378d3/attachment.html>


More information about the swift-users mailing list