uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

Using module_name or package_name with external types causes invalid code to be generated.

Open LBeernaertProton opened this issue 1 year ago • 6 comments

Tested on uniffi v0.26.1 with proc macros

The issues below can be reproduced by having a target library (final product) which uses external types exported in by dependent crates.

Swift

When setting module_name in uniffi.toml for the target crate the bindings generated for swift only include the glue code produced by uniffi. All the exported types from the current and external crates are missing.

Kotlin

When setting package_name for the target crate the bindings generated for kotlin do not compile and they have a mixture of Redeclartion and Unresolved Reference errors for all the ffi functions.

E.g:

Redeclaration: RustBuffer,
Redeclaration: Usize 
Redeclaration: UniffiLib 
Redeclaration: FfiConverterULong

Type mismatch: inferred type is Unit but RustBuffer.ByValue was expected

Unresolved reference: uniffi_<TARGET_CRATE>_fn_func_<FUNCTION_NAME>

LBeernaertProton avatar Mar 12 '24 11:03 LBeernaertProton