Rcpp Version 0.10.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
Rcpp_init.c
Go to the documentation of this file.
1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2 //
3 // Rcpp_init.c : Rcpp R/C++ interface class library -- Initialize and register
4 //
5 // Copyright (C) 2010 - 2012 John Chambers, Dirk Eddelbuettel and Romain Francois
6 //
7 // This file is part of Rcpp.
8 //
9 // Rcpp is free software: you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // Rcpp is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21 #include <R.h>
22 #include <Rinternals.h>
23 #include "internal.h"
24 
25 // borrowed from Matrix
26 #define CALLDEF(name, n) {#name, (DL_FUNC) &name, n}
27 #define EXTDEF(name) {#name, (DL_FUNC) &name, -1}
28 
29 
30 // TODO: check that having this static does not mess up with
31 // RInside, and move it within init_Rcpp_routines otherwise
32 static R_CallMethodDef callEntries[] = {
33  CALLDEF(Class__name,1),
34  CALLDEF(Class__has_default_constructor,1),
35 
36  CALLDEF(CppClass__complete,1),
37  CALLDEF(CppClass__methods,1),
38 
39  CALLDEF(CppObject__finalize,2),
40 
41  CALLDEF(Module__classes_info,1),
42  CALLDEF(Module__complete,1),
43  CALLDEF(Module__get_class,2),
44  CALLDEF(Module__has_class,2),
45  CALLDEF(Module__has_function,2),
46  CALLDEF(Module__functions_arity,1),
47  CALLDEF(Module__functions_names,1),
48  CALLDEF(Module__name,1),
49  CALLDEF(Module__get_function, 2),
50 
54 
55  CALLDEF(CppField__get,3),
56  CALLDEF(CppField__set,4),
57 
60  {NULL, NULL, 0}
61 };
62 
63 static R_ExternalMethodDef extEntries[] = {
71 
72  {NULL, NULL, 0}
73 } ;
74 
75 // this is called by R_init_Rcpp that is in Module.cpp
76 void init_Rcpp_routines(DllInfo *info){
77  /* Register routines, allocate resources. */
78  R_registerRoutines(info,
79  NULL /* .C*/,
80  callEntries /*.Call*/,
81  NULL /* .Fortran */,
82  extEntries /*.External*/
83  );
84 }
85 
86 void R_unload_Rcpp(DllInfo *info) {
87  /* Release resources. */
88 }