Importing struct from C API (FUSE) with member init

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

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&gt;\. 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,
Jordan

···

On Jan 8, 2017, at 01:11, Dennis Schafroth via swift-users <swift-users@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users