Skip to content

C/C++ bindings #13

@RagnarGrootKoerkamp

Description

@RagnarGrootKoerkamp

@kokyriakidis let's continue here from #9.

So calling Rust from C is relatively straightforward, see here.

We could make a crate simd-minimizers-c where we expose a #[unsafe(no_mangle)] pub extern "C" api that simply forwards to the right functions from the root of the library, with the most important template instantiations.

Would you also like to use PackedSeq input? or just plain ascii text?

I will be out for a week and anyway pretty busy. If you could give this a try yourself that would be great!

  • Do cargo new simd-minimizers-c from the root
  • Change to [lib] crate-type=['cdylib'], add simd-minimizers as a dependency, and wrap the functions you need.
  • Then define a header with corresponding extern void ... functions and include that from your code.
  • Lastly build the C code and link against this header.

The c header can also be generated using cbindgen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions