Add header to declare C level API #4645
Merged
mattdowle merged 1 commit intoRdatatable:masterfrom Aug 4, 2020
Merged
Conversation
Member
|
Thanks, @eddelbuettel! I'll invite you to be a project member so you can create branches directly in the main project in future if you wish, and I'll add you to DESCRIPTION in a follow up commit to master (slightly quicker for me than adding that to your PR). |
jangorecki
reviewed
Oct 12, 2020
Comment on lines
+25
to
+27
| static SEXP(*fun)(SEXP, SEXP, SEXP) = | ||
| (SEXP(*)(SEXP,SEXP,SEXP)) R_GetCCallable("data.table", "CsubsetDT"); | ||
| return fun(x,rows,cols); |
Member
There was a problem hiding this comment.
@eddelbuettel is it necessary to create fun object here? couldn't this be a one liner to returning R_GetCCallable() call?
Contributor
Author
There was a problem hiding this comment.
Yes: fun is what is invoked when you call. The static makes the assignment stick, and the R_GetCCallable() ges the identifier from the other package.
hongyuanjia
pushed a commit
to hongyuanjia/data.table
that referenced
this pull request
Dec 29, 2023
hongyuanjia
pushed a commit
to hongyuanjia/data.table
that referenced
this pull request
Dec 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4643.
This PR follows the discussion in #4643 and adds a (very simply and short) file declaring a C level function to access the registered-as-callable function
subsetDT. But providing a function which shields the somewhat unwieldy C function pointer setup, wider use is facilitated. It also offers a benefit for maintenance as it provides another user facing layer allowing the data.table team to redefine or rename the internal function registers as C callable and called here.At present the function can called three ways
DT_subsetDT()with an explicit prefix (and we could consider dropping the suffix...)subsetDT()which is a little cleaner but may clash, this is an opt-indt::subsetDT()where we put a simple C++ namespace around itPlease free to rename or realign as you see fit. I have tested all three access mechanisms (in a simple Rcpp-based test). Doing a proper unit test is likely more work but maybe something we should do. I can help...