eclipse-iceoryx / eclipse-iceoryx/iceoryx

Bindgen generating rust binding failed.

Open
#879 23 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2.2k
Forks
492
Avg merge
18h 57m
Merged PRs (30d)
1

Description

## Required information

I am using rust bindgen to generate rust binding based on iceoryx-binding-c.

And found that the struct `iox_notification_info_t` defined here directly refers to hpp file `iceoryx_posh/include/iceoryx_posh/popo/notification_info.hpp` with `class NotificationInfo`

https://github.com/eclipse-iceoryx/iceoryx/blob/abca825cf4c56de44b548128a8bb4d917d456869/iceoryx_binding_c/include/iceoryx_binding_c/notification_info.h#L25

**Observed result or behaviour:**

The c-binding is not pure.

given wraper.h

```cpp
#include "iceoryx_binding_c/api.h"
```

rust bindgen outputs error msgs as follows:

```sh
cargo:rerun-if-changed=wrapper.h

--- stderr
/usr/local/include/iceoryx_binding_c/wait_set.h:53:28: error: unknown type name 'iox_notification_info_t'
/usr/local/include/iceoryx_binding_c/wait_set.h:66:22: error: unknown type name 'iox_notification_info_t'
/usr/local/include/iceoryx_binding_c/wait_set.h:53:28: error: unknown type name 'iox_notification_info_t', err: true
/usr/local/include/iceoryx_binding_c/wait_set.h:66:22: error: unknown type name 'iox_notification_info_t', err: true
thread 'main' panicked at 'Unable to generate bindings: ()', build.rs:37:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

**Expected result or behaviour:**

api expoting normally.

`class NotificationInfo` should be rewrite to the struct like this

https://github.com/eclipse-iceoryx/iceoryx/blob/abca825cf4c56de44b548128a8bb4d917d456869/iceoryx_binding_c/include/iceoryx_binding_c/wait_set.h#L31

**Conditions where it occurred / Performed steps:**

Not export c api in `iceoryx_binding_c/wait_set.h` make error msgs disapear.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.