dart-lang / dart-lang/native

[C] "Inline" function available in compiled dylib, but no bindings generated by ffigen?

Open
#459 10 comments 0 reactions 0 assignees View on GitHub
package:ffigen
Dominant language
Dart
Stars
275
Forks
144
Avg merge
2d 10h
Merged PRs (30d)
47

Description

I'm currently trying to bind a bitset implementation found in CRoaring to Dart via ffigen.

As expected, ffigen doesn't seem to generate bindings for inline functions such as:

```
static inline size_t bitset_size_in_words(const bitset_t *bitset) {
return bitset->arraysize;
}
```

As expected, this function is not visible in the compiled dylib when searched for via `nm -gU libroaring.dylib`

However, if the static is changed to `extern`, i.e.:

```
extern inline size_t bitset_size_in_words(const bitset_t *bitset) {
return bitset->arraysize;
}
```

Then the function becomes available in the compiled dylib:

```
> nm -gU libroaring.dylib | grep bitset_size_in_words
> 0000000000001b08 T _bitset_size_in_words
```

but ffigen still won't generate bindings for it despite it being available in the dylib.

I'm wondering what's the exact limitation here? If a function is available in the dylib, shouldn't ffigen be able to generate appropriate bindings for it (regardless of whether it is inline annotated or not?)

Cf. https://github.com/RoaringBitmap/CRoaring/issues/487

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.