Open acovaci opened 2 months ago
This can be reduced to this:
#include <filesystem>
This is something to do with <filesystem>
on Windows. It does not happen on Linux. I can't manage to reduce it further because I can't get creduce to work on Windows
@acovaci you should allowlist the types and functions you need. That should prevent this from happening.
@Kriskras99 I'm having the same issue. Also tried it in a tiny test project, as soon as you #include <filesystem>
in the C++ header (even without using any std::filesystem
stuff in the C++ code), the attempt to add with overflow issue occurs.
@jasper-bosch that's because if you don't specify an allowlist, bindgen will generate bindings for everything that is included. So use an allowlist to import the types you need.
@Kriskras99 Sorry, forgot to mention it before. I also tried using std::filesystem::path
in my test project, just to test and allowlisting that type (.allowlist_type("std::filesystem::path")
), but that didn't help.
@jasper-bosch then it's likely (one of) the definition(s) causing issues. If you don't need to access to the fields of the type you can try to make it an opaque type.
See also the bindgen guide on C++: https://rust-lang.github.io/rust-bindgen/cpp.html
Thanks @Kriskras99! Marked all of std::.*
as opaque and allowlisted only what I need.
Would be good to get a repro for that regardless since it seems we're failing to deal with something complex inside the windows header.
I know you're asking for a minimal header, but I don't have enough C++ experience to be able to understand exactly what's going on. If anyone wants to pair up on this to come up with an example, I'm more than happy to do so. Instead, I'll link to the exact header file I'm using
Input C/C++ Header
https://github.com/AurieFramework/YYToolkit/blob/stable/ExamplePlugin/include/YYToolkit/Shared.hpp
Bindgen Invocation
Actual Results
Expected Results
Well, if I understand the bindgen logic, the fact it went down so many
level
s is not expected behaviour. A more useful error message, maybe pointing out to what might be going on, what might be causing this?