[swift-users] Importing struct from C API (FUSE) with member init

Jordan Rose jordan_rose at apple.com
Mon Jan 9 15:00:33 CST 2017

Hey, Dennis. You should be able to use backticks to escape Swift keywords, including this one. However, that doesn't actually work yet, due to SR-1660 <https://bugs.swift.org/browse/SR-1660>. There's been some progress towards fixing this, but it's not ready to go into a release yet.

If you can modify the header, the easiest answer is to add a swift_name attribute (`__attribute__((swift_name("initOp")))`). If you can't, the next best thing is probably to write a static inline wrapper function in C, unfortunately.

Sorry for the inconvenience,

> On Jan 8, 2017, at 01:11, Dennis Schafroth via swift-users <swift-users at swift.org> wrote:
> Is there any solutions to importing structs from C API where there is a member init.
> The fuse_operations is a struct with callbacks functions and one is called init 
> struct fuse_operations {
> 	void *(*init) (struct fuse_conn_info *conn);
> }
> This seems to collide with the Swift init method on imported C struct
> cheers,
> :-Dennis
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170109/5d5d9740/attachment.html>

More information about the swift-users mailing list