Skip to content

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

Open
dart-archive/ffigen
#594
@modulovalue

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. RoaringBitmap/CRoaring#487

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions