You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "can_handle" restriction looks artificial and unnecessary, if it is commented out, then the correct constant definition is generated.
// C++
static const MyInt MY_CONST = 10;
// C
#define MY_CONST 10
In both cases it doesn't matter what MyInt actually is, cbindgen just can put it into the constant definition textually and it will work in most cases if the right hand side can be converted to C/C++.
The text was updated successfully, but these errors were encountered:
Yeah, I think we should tweak can_handle to handle the kind of expressions we actually support rather than doing it based on the type of the expression...
cbindgen
will produce a "Unhandled const definition" error onMY_CONST
becauseMyInt
is not a "can_handle
" typehttps://github.com/eqrion/cbindgen/blob/1fc4cb072422e722f8bcb3af5766f84587a180c6/src/bindgen/ir/constant.rs#L393-L395
https://github.com/eqrion/cbindgen/blob/1fc4cb072422e722f8bcb3af5766f84587a180c6/src/bindgen/ir/constant.rs#L366-L374
The "
can_handle
" restriction looks artificial and unnecessary, if it is commented out, then the correct constant definition is generated.In both cases it doesn't matter what
MyInt
actually is, cbindgen just can put it into the constant definition textually and it will work in most cases if the right hand side can be converted to C/C++.The text was updated successfully, but these errors were encountered: