Skip to content

Commit

Permalink
Implement core 0.2 changes
Browse files Browse the repository at this point in the history
- Make code generator emit C functions that take in a single object that contains both the object and the return context. This simplifies usage from C/C++.

- Remove zero wrapper optimization. The above is incompatible with it.

- Remove CtxBox, as context has been moved into the container object.
  • Loading branch information
h33p committed Oct 7, 2021
1 parent f09a768 commit e589a01
Show file tree
Hide file tree
Showing 20 changed files with 1,007 additions and 1,007 deletions.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -11,6 +11,11 @@ If all code is glued together, our glue is the safest on the market.

## FFI-safe trait generation, helper structures, and more!

**WARNING: following documentation is currently valid for
[stable 0.1.x series](https://github.com/h33p/cglue/tree/v0.1.3)**

*This is a 0.2 development branch, documentation is to be updated ASAP*

<!-- toc -->
- [Overview](#overview)
- [In-depth look](#in-depth-look)
Expand Down Expand Up @@ -58,7 +63,7 @@ fn use_info_printer(printer: &impl InfoPrinter) {
printer.print_info();
}

fn main() {
fn main() -> () {
let mut info = Info {
value: 5
};
Expand Down
2 changes: 1 addition & 1 deletion cglue-gen/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cglue-gen"
version = "0.1.4"
version = "0.2.0"
authors = ["Aurimas Blažulionis <0x60@pm.me>"]
edition = "2018"
description = "FFI safe code generation for making plugins and C-compatible libraries"
Expand Down
4 changes: 0 additions & 4 deletions cglue-gen/src/ext/mod.rs
Expand Up @@ -187,18 +187,14 @@ pub fn impl_store() -> TokenStream {
"Ext",
"Vtbl",
"RetTmp",
"OpaqueVtbl",
"Any",
"Box",
"CtxBox",
"NoCtxBox",
"ArcBox",
"Mut",
"Ref",
"Base",
"BaseBox",
"BaseCtxBox",
"BaseNoCtxBox",
"BaseArcBox",
"BaseMut",
"BaseRef",
Expand Down
2 changes: 1 addition & 1 deletion cglue-gen/src/forward.rs
Expand Up @@ -17,6 +17,7 @@ pub fn gen_forward(tr: ItemTrait, ext_path: Option<TokenStream>) -> TokenStream
format_ident!("Self"),
WrappedType {
ty: parse2(quote!(Self)).unwrap(),
ty_ret_tmp: None,
ty_static: None,
return_conv: None,
lifetime_bound: None,
Expand All @@ -26,7 +27,6 @@ pub fn gen_forward(tr: ItemTrait, ext_path: Option<TokenStream>) -> TokenStream
impl_return_conv: None,
inject_ret_tmp: false,
unbounded_hrtb: false,
needs_ctx: false,
},
);

Expand Down

0 comments on commit e589a01

Please sign in to comment.