jean-pierreBoth / hnswlib-rs

Rust implementation of the HNSW algorithm (Malkov-Yashunin)
Other
156 stars 22 forks source link

Generating a C .h binding #5

Closed spullara closed 2 years ago

spullara commented 2 years ago

I see that with Julia this isn't necessary as the calls are all dynamic, however, I'm trying to integrate the library with Swift and it requires a header file. To that end I was attempting to use cbindgen to create one but it fails, I think, because of the use of macros to define some of the types:

WARN: Skip hnsw_rs::NB_LAYER_MAX - (not `pub`).
WARN: Skip hnsw_rs::M_MIN - (not `pub`).
WARN: Skip hnsw_rs::MAGICPOINT - (not `pub`).
WARN: Skip hnsw_rs::MAGICDESCR_1 - (not `pub`).
WARN: Skip hnsw_rs::MAGICDESCR_2 - (not `pub`).
WARN: Skip hnsw_rs::MAGICLAYER - (not `pub`).
WARN: Skip hnsw_rs::MAGICDATAP - (not `pub`).
WARN: Can't find HnswApif32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApif32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu16. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApif32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApif32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApif32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApif32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApii32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApii32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu32. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu16. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu16. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu16. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu8. This usually means that this type was incompatible or not found.
WARN: Can't find HnswApiu8. This usually means that this type was incompatible or not found.

What do you suggest?

spullara commented 2 years ago

I have solved this issue with a cbindgen setting but only works on nightly:

[parse]
expand = ["hnsw_rs"]