Bindgen #define with cast

⚓ Rust    📅 2025-10-04    👤 surdeus    👁️ 5      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Bindgen #define with cast

Hello,

I am using bindgen in my project for a c source code. I am encountering difficulties with the different #define.

So this #define is not generated:

#define MY_DEFINE    ((int) 'c')

whereas this #define is generated:

#define MY_DEFINE 'c'

I am under the impression that the casting prevents bindgen from generating the equivalent rust code.

Is this intended or a bug ? Is there a workaround ?

Thank you very much in advance for any help

1 post - 1 participant

Read full topic

🏷️ Rust_feed