oooutlk / tcltk

Rust bindings to Tcl/Tk commands
Apache License 2.0
22 stars 3 forks source link

Cannot use `tclfn!` macro without also adding "clib" dependency to crate #3

Closed 4LT closed 1 year ago

4LT commented 1 year ago

Attempting to use the tclfn macro imported from tcl into my own crate/module results in the following error:

 1  error[E0433]: failed to resolve: use of undeclared crate or module `clib`
   --> src/main.rs:59:5
    |
 59 | /     tclfn!(
 60 | |         &interp,
 61 | |         fn app_load_image(s: String) -> Result<(), ProcError> {
 62 | |             load_image(s)
 63 | |         }
 64 | |     );
    | |_____^ use of undeclared crate or module `clib`
    |
    = note: this error originates in the attribute macro `tcl::proc` (in Nightly builds, run with -Z macro-backtrace for more info)
oooutlk commented 1 year ago

Oops, the output of #[proc] contains some clib::s which expose the crate clib. I will convert all of clib:: to tcl::reexport_clib:: in tcl_derive 0.1.1 and add the following in tcl 0.1.3:

pub mod reexport_clib {
    pub use clib::{
        ClientData,
        TCL_ERROR,
        TCL_OK,
        Tcl_Interp,
        Tcl_InvalidateStringRep,
        Tcl_Obj,
        Tcl_SetObjResult,
        Tcl_WrongNumArgs,
    };
}
oooutlk commented 1 year ago

Just created a new branch "develop" and remove the requirement of "clib" dependency when using tcl_derive's proc macros.

oooutlk commented 1 year ago

Forget to mention that, this issue has been fixed in tcl 0.1.3