cbindgen icon indicating copy to clipboard operation
cbindgen copied to clipboard

Modules inside cfg_if! macros aren't read / expanded (was: The C header file cannot be generated correctly.)

Open ssrlive opened this issue 1 year ago • 8 comments

The c header file cannot be generated correctly. This is my project. I entered the project root directory and entered the command cbindgen -l c, and got the following output. I did not see the expected function prototype socks_hub_run and so on.

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>

image

ssrlive avatar Mar 24 '24 05:03 ssrlive

emm, I have found the reason, it's about cfg_if::cfg_if! macro. when I remove it, cbindgen works fine.

can you fix it as a bug?

image

ssrlive avatar Mar 24 '24 06:03 ssrlive

There's the cargo expand feature that should work, right?

emilio avatar Apr 05 '24 09:04 emilio