Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ssrlive opened this issue Mar 24, 2024 · 2 comments

Comments

@ssrlive
Copy link

ssrlive commented Mar 24, 2024

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
Copy link
Author

ssrlive commented Mar 24, 2024

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 added a commit to tun2proxy/socks-hub that referenced this issue Mar 24, 2024
@emilio
Copy link
Collaborator

emilio commented Apr 5, 2024

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

@emilio emilio changed the title The C header file cannot be generated correctly. Modules inside cfg_if! macros aren't read / expanded (was: The C header file cannot be generated correctly.) Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants