mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.29k stars 294 forks source link

Not scan file content import by micro include! ? #909

Closed luodongseu closed 3 months ago

luodongseu commented 6 months ago

I have a rust file named c.rs which import by include! in lib.rs and cbindgen generate c header file cannot include the file content, and I don't know how to resolve it.

lib.rs

include!("c.rs");

And c.rs content:

pub unsafe extern "C" fn m_func() {}
emilio commented 3 months ago

We can't expand macros by default, see the expand option in the docs for workarounds.

emilio commented 3 months ago

For include! in particular perhaps we could expand it ourselves tho... Maybe worth a patch if somebody wants to submit it :)