hdf5r icon indicating copy to clipboard operation
hdf5r copied to clipboard

[Feature request] Expose C level API via headers in compiled package

Open dipterix opened this issue 5 years ago • 4 comments

Hi, is there any plan to expose C level API to inst/include so that others can link to this wonderful package and call its C functions directly?

dipterix avatar May 02 '20 16:05 dipterix

I currently have no plans to develop this package further. My main focus has shifted to Python in recent years and I have very limited time to spend on it. But you should be able to call the functions using .Call from R, no?

hhoeflin avatar May 04 '20 05:05 hhoeflin

I want to link to your package with Rcpp. Basically include the headers from your package and write c++ functions instead of operating in R.

#Linking-to-other-packages

Basically it requires static header files from your package in inst/include/ path so that I can extend your package without copying and edit yours.

Here's an example from another package.

dipterix avatar May 08 '20 09:05 dipterix

This is actually made a bit more complicated as the headers files vary by HDF5 version. In the current workflow, each major upgrade of HDF5 behind the scenes has new header files. So a-priori, you wouldn't be able to program against a stable set.

hhoeflin avatar May 09 '20 05:05 hhoeflin

If I guessed it correctly, even though there is a C wrapper for HDF5 library, but the wrapper actually varies when HDF5 version changes. As a result, if I can link to your package wrappers, I won't be able to assume your wrappers providing stable functions, or the wrapper itself can only be dynamically loaded?

dipterix avatar May 09 '20 12:05 dipterix