annotate R/rdyncall/src/rpackage.c @ 66:7a61dd082341 default tip

pydc: - fix double free triggered by capsule destructor, when freeing pydc and callback objects, manually
author Tassilo Philipp
date Fri, 24 May 2024 18:16:29 +0200
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /** ===========================================================================
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 ** R-Package: rdyncall
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 ** File: src/rpackage.c
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 ** Description: R package registry
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 **/
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 #include <Rinternals.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 #include <R_ext/Rdynload.h>
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 /** ---------------------------------------------------------------------------
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 ** Package contents:
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 /* rdyncall.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 SEXP r_new_callvm(SEXP callmode, SEXP size);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 SEXP r_free_callvm(SEXP callvm);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 SEXP r_dyncall(SEXP args); /* .External() with args = callvm, address, signature, args */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 /* rdynload.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 SEXP r_dynload(SEXP libpath);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 SEXP r_dynsym(SEXP libobj, SEXP symname, SEXP protectlib);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 SEXP r_dynunload(SEXP libobj);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 /* rpack.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 SEXP r_pack(SEXP ptr, SEXP offset, SEXP sig, SEXP value);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 SEXP r_unpack(SEXP ptr, SEXP offset, SEXP sig);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 /* rcallback.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29 SEXP r_new_callback(SEXP sig, SEXP fun, SEXP rho, SEXP mode);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31 /* rutils.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 SEXP r_asextptr(SEXP v);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 SEXP r_isnullptr(SEXP x);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 SEXP r_offsetPtr(SEXP x, SEXP offset);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 /* rutils_str.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 SEXP r_ptr2str(SEXP ptr);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 SEXP r_strarrayptr(SEXP ptr);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 SEXP r_strptr(SEXP x);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 /* rutils_float.c */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 SEXP r_as_floatraw(SEXP real);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 SEXP r_floatraw2numeric(SEXP floatraw);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 /** ---------------------------------------------------------------------------
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 ** R Interface .External registry
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 R_ExternalMethodDef externalMethods[] =
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 /* --- rdyncall.c -------------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 {"dyncall", (DL_FUNC) &r_dyncall, -1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 /* --- end (sentinel) ---------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 {NULL,NULL,0}
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 };
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 /** ---------------------------------------------------------------------------
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 ** R Interface .Call registry
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 R_CallMethodDef callMethods[] =
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 /* --- rdyncall.c -------------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 {"new_callvm" , (DL_FUNC) &r_new_callvm , 2},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 {"free_callvm" , (DL_FUNC) &r_free_callvm , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 /* --- rdynload.c -------------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
67 {"dynload" , (DL_FUNC) &r_dynload , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 {"dynsym" , (DL_FUNC) &r_dynsym , 3},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 {"dynunload" , (DL_FUNC) &r_dynunload , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 /* --- rcallback.c ------------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 {"new_callback" , (DL_FUNC) &r_new_callback , 3},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 /* --- rpack.c ----------------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 {"pack" , (DL_FUNC) &r_pack , 4},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 {"unpack" , (DL_FUNC) &r_unpack , 3},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 /* --- rutils.c ---------------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76 {"asextptr" , (DL_FUNC) &r_asextptr , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 {"isnullptr" , (DL_FUNC) &r_isnullptr , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 {"offsetPtr" , (DL_FUNC) &r_offsetPtr , 2},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
79 /* --- rutils_str.c ------------------------------------------------------ */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80 {"r_ptr2str" , (DL_FUNC) &r_ptr2str , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 {"r_strarrayptr" , (DL_FUNC) &r_strarrayptr , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82 {"r_strptr" , (DL_FUNC) &r_strptr , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
83 /* --- rutils_float.c ---------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 {"r_as_floatraw" , (DL_FUNC) &r_as_floatraw , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 {"r_floatraw2numeric" , (DL_FUNC) &r_floatraw2numeric , 1},
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 /* --- end (sentinel) ---------------------------------------------------- */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 {NULL,NULL, 0}
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 };
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 /** ---------------------------------------------------------------------------
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 ** R Library entry:
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92 */
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 void R_init_rdyncall(DllInfo *info)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 R_registerRoutines(info, NULL, callMethods, NULL, externalMethods);
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 }
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 void R_unload_rdyncall(DllInfo *info)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100 {
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 }