Skip to content

Commit

Permalink
Register symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Apr 2, 2024
1 parent d35e579 commit 54dac29
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Generated by roxygen2: do not edit by hand

export(l1tf)
useDynLib(l1tf,l1tf_R)
useDynLib(l1tf,l1tf_lambdamax_R)
useDynLib(l1tf, .registration = TRUE)
2 changes: 1 addition & 1 deletion R/l1tf.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param prop A number between 0 and 1. Specify lambda as a proportion of the
#' maximum lambda for the input dataset.
#' @param debug If `TRUE` will print details about each iteration.
#' @useDynLib l1tf l1tf_R l1tf_lambdamax_R
#' @useDynLib l1tf, .registration = TRUE
#' @export
#' @examples
#' x <- runif(1000)
Expand Down
20 changes: 20 additions & 0 deletions src/register.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* .Call calls */
extern SEXP l1tf_lambdamax_R(SEXP, SEXP);
extern SEXP l1tf_R(SEXP, SEXP, SEXP);

static const R_CallMethodDef CallEntries[] = {
{"l1tf_lambdamax_R", (DL_FUNC) &l1tf_lambdamax_R, 2},
{"l1tf_R", (DL_FUNC) &l1tf_R, 3},
{NULL, NULL, 0}
};

void R_init_l1tf(DllInfo *dll)
{
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}

0 comments on commit 54dac29

Please sign in to comment.