The R Project SVN R

Rev

Rev 86521 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14080 ripley 1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
83012 kalibera 3
 *  Copyright (C) 2001-2022  The R Core Team.
14080 ripley 4
 *
71657 plummer 5
 *  This header file is free software; you can redistribute it and/or modify
14080 ripley 6
 *  it under the terms of the GNU Lesser General Public License as published by
7
 *  the Free Software Foundation; either version 2.1 of the License, or
8
 *  (at your option) any later version.
9
 *
71657 plummer 10
 *  This file is part of R. R is distributed under the terms of the
11
 *  GNU General Public License, either Version 2, June 1991 or Version 3,
12
 *  June 2007. See doc/COPYRIGHTS for details of the copyright status of R.
13
 *
14080 ripley 14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU Lesser General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU Lesser General Public License
42308 ripley 20
 *  along with this program; if not, a copy is available at
68949 ripley 21
 *  https://www.R-project.org/Licenses/
14080 ripley 22
 */
23
 
60253 ripley 24
/*
25
  C functions used to register compiled code in packages.
26
 
27
  Those needed for that purpose are part of the API.
72375 ripley 28
 
29
  Cleaned up for R 3.4.0, some changes require recompilation of packages.
60253 ripley 30
 */
31
 
15885 hornik 32
#ifndef  R_EXT_DYNLOAD_H_
33
#define  R_EXT_DYNLOAD_H_
13949 duncan 34
 
19500 hornik 35
#include <R_ext/Boolean.h>
14571 duncan 36
 
83012 kalibera 37
/* Called with a variable argument set after casting to a compatible
38
   function pointer.  */
39
typedef void * (*DL_FUNC)(void);
14102 duncan 40
 
20110 duncan 41
typedef unsigned int R_NativePrimitiveArgType;
42
 
72375 ripley 43
/* For interfaces to objects created with as.single */
44
#define SINGLESXP 302
20110 duncan 45
 
72228 ripley 46
/*
72375 ripley 47
 These are very similar to those in Rdynpriv.h,
13949 duncan 48
 but we maintain them separately to give us more freedom to do
49
 some computations on the internal versions that are derived from
50
 these definitions.
51
*/
52
typedef struct {
14080 ripley 53
    const char *name;
14102 duncan 54
    DL_FUNC     fun;
14080 ripley 55
    int         numArgs;
20110 duncan 56
    R_NativePrimitiveArgType *types;
13949 duncan 57
} R_CMethodDef;
58
 
20110 duncan 59
typedef R_CMethodDef R_FortranMethodDef;
13949 duncan 60
 
20110 duncan 61
 
13949 duncan 62
typedef struct {
14080 ripley 63
    const char *name;
14102 duncan 64
    DL_FUNC     fun;
14080 ripley 65
    int         numArgs;
13949 duncan 66
} R_CallMethodDef;
72228 ripley 67
 
20110 duncan 68
typedef R_CallMethodDef R_ExternalMethodDef;
13949 duncan 69
 
70
 
71
typedef struct _DllInfo DllInfo;
72
 
72231 ripley 73
/*
14571 duncan 74
  Currently ignore the graphics routines, accessible via .External.graphics()
75
  and .Call.graphics().
76
 */
72231 ripley 77
#ifdef __cplusplus
39865 duncan 78
extern "C" {
79
#endif
14178 duncan 80
int R_registerRoutines(DllInfo *info, const R_CMethodDef * const croutines,
72231 ripley 81
		       const R_CallMethodDef * const callRoutines,
14571 duncan 82
		       const R_FortranMethodDef * const fortranRoutines,
72231 ripley 83
		       const R_ExternalMethodDef * const externalRoutines);
13949 duncan 84
 
39865 duncan 85
Rboolean R_useDynamicSymbols(DllInfo *info, Rboolean value);
60373 ripley 86
Rboolean R_forceSymbols(DllInfo *info, Rboolean value);
39865 duncan 87
 
86521 ripley 88
/* Not API */
89135 luke 89
#ifdef USE_BASE_R_SUPPORT
13949 duncan 90
DllInfo *R_getDllInfo(const char *name);
89135 luke 91
#endif
13949 duncan 92
 
72375 ripley 93
/* To be used by applications embedding R to register their symbols
86521 ripley 94
   that are not related to any dynamic module/
95
 
96
   Not API
97
*/
44195 ripley 98
DllInfo *R_getEmbeddingDllInfo(void);
14102 duncan 99
 
14571 duncan 100
typedef struct Rf_RegisteredNativeSymbol R_RegisteredNativeSymbol;
101
typedef enum {R_ANY_SYM=0, R_C_SYM, R_CALL_SYM, R_FORTRAN_SYM, R_EXTERNAL_SYM} NativeSymbolType;
102
 
103
 
86521 ripley 104
/* Not API */
72231 ripley 105
DL_FUNC R_FindSymbol(char const *, char const *,
106
		       R_RegisteredNativeSymbol *symbol);
14571 duncan 107
 
14077 duncan 108
 
72228 ripley 109
/* Interface for exporting and importing functions from one package
110
   for use from C code in a package.  The registration part probably
111
   ought to be integrated with the other registrations.  The naming of
112
   these routines may be less than ideal.
86521 ripley 113
 
114
   Declarations in the manual, so API
72228 ripley 115
*/
38870 luke 116
 
41869 ripley 117
void R_RegisterCCallable(const char *package, const char *name, DL_FUNC fptr);
118
DL_FUNC R_GetCCallable(const char *package, const char *name);
38870 luke 119
 
72231 ripley 120
#ifdef __cplusplus
42653 ripley 121
}
122
#endif
123
 
15885 hornik 124
#endif /* R_EXT_DYNLOAD_H_ */