From 70f3d57a3ccda129a7e4db3beb8b46f79c21744a Mon Sep 17 00:00:00 2001 From: Florian Gerber <florian.gerber@math.uzh.ch> Date: Tue, 12 Dec 2017 09:32:26 +0100 Subject: [PATCH] F77_NAME not found --- DESCRIPTION | 4 ++-- NAMESPACE | 2 +- R/dotCall64.R | 2 +- man/dotCall64.Rd | 3 +-- man/vector_dc.Rd | 5 ++--- src/init.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 src/init.c diff --git a/DESCRIPTION b/DESCRIPTION index e4a555f..75b9b3c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: dotCall64 Type: Package Title: Enhanced Foreign Function Interface Supporting Long Vectors Version: 0.9-5 -Date: 2017-12-11 +Date: 2017-12-12 Authors@R: c(person("Kaspar", "Moesinger", role = c("aut"), email = "kaspar.moesinger@gmail.com"), person("Florian", "Gerber", role = c("cre", "ctb"), @@ -30,4 +30,4 @@ Collate: 'vector_dc.R' 'dotCall64.R' 'zzz.R' -RoxygenNote: 5.0.1 +RoxygenNote: 6.0.1 diff --git a/NAMESPACE b/NAMESPACE index 535dca6..5fbefdf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,4 +4,4 @@ export(.C64) export(integer_dc) export(numeric_dc) export(vector_dc) -useDynLib(dotCall64) +useDynLib(dotCall64, .registration = TRUE) diff --git a/R/dotCall64.R b/R/dotCall64.R index 6172966..74d3ff2 100644 --- a/R/dotCall64.R +++ b/R/dotCall64.R @@ -113,7 +113,7 @@ #' input = x_long, index = 2^31, output = double(1))$output #' #' } -#' @useDynLib dotCall64 +#' @useDynLib dotCall64, .registration = TRUE #' @export #' @name dotCall64 .C64 <- function(.NAME, SIGNATURE, ..., INTENT = NULL, NAOK = FALSE, diff --git a/man/dotCall64.Rd b/man/dotCall64.Rd index 3223e0e..746c650 100644 --- a/man/dotCall64.Rd +++ b/man/dotCall64.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/dotCall64.R \name{dotCall64} -\alias{.C64} \alias{dotCall64} +\alias{.C64} \title{dotCall64 - Extended Foreign Function Interface} \usage{ .C64(.NAME, SIGNATURE, ..., INTENT = NULL, NAOK = FALSE, PACKAGE = "", @@ -131,4 +131,3 @@ F. Gerber, K. Moesinger, and R. Furrer (2017), dotCall64: An efficient interface to compiled C/C++ and Fortran code supporting long vectors, https://arxiv.org/abs/1702.08188. } - diff --git a/man/vector_dc.Rd b/man/vector_dc.Rd index c224ad2..5618842 100644 --- a/man/vector_dc.Rd +++ b/man/vector_dc.Rd @@ -1,9 +1,9 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/vector_dc.R \name{vector_dc} -\alias{integer_dc} -\alias{numeric_dc} \alias{vector_dc} +\alias{numeric_dc} +\alias{integer_dc} \title{Allocate vectors in .C64()} \usage{ vector_dc(mode = "logical", length = 0L) @@ -32,4 +32,3 @@ leads to performance gains by avoiding unnecessary castings and copies. \examples{ vector_dc("integer", 20) } - diff --git a/src/init.c b/src/init.c new file mode 100644 index 0000000..b34b6f1 --- /dev/null +++ b/src/init.c @@ -0,0 +1,55 @@ +#include <R_ext/RS.h> +#include <stdlib.h> // for NULL +#include <R_ext/Rdynload.h> + +/* to get all functions: + + nm -g lib/dotCall64/libs/dotCall64.so | grep " T " + +*/ + +// C +extern void BENCHMARK ( void *); +extern void dC64 ( void *); +extern void get64_c ( void *, void *, void *); +extern void get_c ( void *, void *, void *); +extern void TEST_prod_double ( void *, void *); +extern void TEST_prod_int ( void *, void *); +extern void TEST_prod_int64 ( void *, void *); +extern void TEST_times2_double ( void *, void *); +extern void TEST_times2_int ( void *, void *); +extern void TEST_times2_int64 ( void *, void *); + +// Fortran +extern void TEST_times2_int64 ( void *, void *); + + + +static const R_CallMethodDef CEntries[] = { + {"BENCHMARK", (DL_FUNC)&BENCHMARK, 1}, + {"dC64", (DL_FUNC)&dC64, 1}, + {"get64_c", (DL_FUNC)&get64_c, 3}, + {"get_c", (DL_FUNC)&get_c, 3}, + {"TEST_prod_double", (DL_FUNC)&TEST_prod_double, 2}, + {"TEST_prod_int", (DL_FUNC)&TEST_prod_int, 2}, + {"TEST_prod_int64", (DL_FUNC)&TEST_prod_int64, 2}, + {"TEST_times2_double", (DL_FUNC)&TEST_times2_double, 2}, + {"TEST_prod_int", (DL_FUNC)&TEST_prod_int, 2}, + {"TEST_prod_int64", (DL_FUNC)&TEST_prod_int64, 2}, + {NULL, NULL, 0} +}; + + +static const R_FortranMethodDef FortranEntries[] = { + {"get_f", (DL_FUNC) &F77_NAME(get_f ), 3}, + {"get64_f", (DL_FUNC) &F77_NAME(get64_f), 3}, + {NULL, NULL, 0} +}; + +void R_init_spam(DllInfo *dll) +{ + R_registerRoutines(dll, NULL, NULL, FortranEntries, NULL); + R_registerRoutines(dll, NULL, CEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); +} + -- GitLab