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

Do not include #[test] functions #58

Closed
snaulX opened this issue Oct 15, 2023 · 3 comments
Closed

Do not include #[test] functions #58

snaulX opened this issue Oct 15, 2023 · 3 comments

Comments

@snaulX
Copy link

snaulX commented Oct 15, 2023

I create tests for bindings in the same file with bindings themselves (or else it gets me a lot of troubles with visibility). And these test functions are includuded in bindings for C# so maybe don't include functions with #[test] attribute? Or maybe even include only functions with #[no_mangle] attribute? I can make pull request if this feature is needed.

@neuecc
Copy link
Member

neuecc commented Oct 16, 2023

The only current extraction is the extern method.
Is this is almost identical to no_mangle?

@snaulX
Copy link
Author

snaulX commented Oct 16, 2023

As I know, no_mangle disables Rust name mangling for the function, so it will have a normal name without internal compiler information. So we remove functions with '"strange names" from bindings as we check it on no_mangle.
Also I think that there's need check of pub visibility because else function just will not be showed in dll as exported.

@hadashiA
Copy link
Contributor

hadashiA commented Jan 5, 2024

Thanks for the suggenstion. I think you are right that we should check for no_mangle.

  • However, for #[test], it should not be covered without extern.
  • Also, the pub access modifier is also a visibility on Rust and should not be covered by ffi.

I have made a fixing to your point #66 . I also commented here #60 (comment). I hope you will check it.

@hadashiA hadashiA closed this as completed Jan 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

3 participants