dmlc / dmlc/xgboost

[Feature proposal] Expose xgboost/c_api.h in R package for LinkingTo

Open
#5,979 6 comments 2 reactions 0 assignees View on GitHub
feature-request
Dominant language
C++
Stars
28.8k
Forks
8.9k
Avg merge
1d 12h
Merged PRs (30d)
54

Description

I am working on an R package which involves running lots of models, with various inputs/datasets, and doing various things with the outputs. Since speed is an important consideration, I am writing most of the code using C++ (embedded into the R package using the Rcpp package) and I am directly interfacing with the xgboost C api (via ``). Would it be possible to update the xgboost R package so that it provides a header file (in `inst/include` folder) that other R packages can link to so they can use the functions in ``? At the moment, I have just copy-and-pasted the xgboost code into the `src` folder of this R package (after building the xgboost R package tarball) -- but this is not ideal and (most likely) means that I won't be releasing it on CRAN when it's finished. For example, the [RcppGSL package provides linking to GSL](https://github.com/eddelbuettel/rcppgsl) so that other R packages can include GSL by adding `LinkingTo: RcppGSL` in their DESCRIPTION file (e.g. see the smam R package; https://github.com/ChaoranHu/smam and the DESCRIPTION file https://github.com/ChaoranHu/smam/blob/master/DESCRIPTION).

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the R package's inst/include layout and the c_api.h packaging path; compare the RcppGSL and smam DESCRIPTION/LinkingTo examples cited in the issue. Done means an installed xgboost R package exposes the header and another R package can include the C API through LinkingTo.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, r
Domain
developer-experience, machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.