当前位置: 软件>C/C++软件
跨语言类型声明和接口绑定 Djinni
来源: http://www.oschina.net/p/djinni
发布时间:2014-12-14
本文导语: Djinni 是一个用来生成跨语言的类型声明和接口绑定的工具,主要用于 C++ 和 Java 以及 Objective-C 间的互通。 示例接口定义文件: # Multi-line comments can be added here. This comment will be propagated # to each generated definition. my_enum =...
Djinni 是一个用来生成跨语言的类型声明和接口绑定的工具,主要用于 C++ 和 Java 以及 Objective-C 间的互通。
示例接口定义文件:
# Multi-line comments can be added here. This comment will be propagated # to each generated definition. my_enum = enum { option1; option2; option3; } my_record = record { id: i32; info: string; store: set; hash: map; values: list; # Comments can also be put here # Constants can be included const string_const: string = "Constants can be put here"; const min_value: another_record = { key1 = 0, key2 = "" }; } another_record = record { key1: i32; key2: string; } deriving (eq, ord) # This interface will be implemented in C++ and can be called from any language. my_cpp_interface = interface +c { method_returning_nothing(value: i32); method_returning_some_type(key: string): another_record; static get_version(): i32; # Interfaces can also have constants const version: i32 = 1; } # This interface will be implemented in Java and ObjC and can be called from C++. my_client_interface = interface +j +o { log_string(str: string): bool; }
使用方法:
@import "relative/path/to/filename.djinni"
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。