Skip to content

Commit 7ecadc3

Browse files
authored
Expand libraries vignette with PACKAGE_types.h (#1355)
* Expand libraries vignette with PACKAGE_types.h * Correct missing word spotted by @Enchufa2
1 parent 55a4f01 commit 7ecadc3

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

ChangeLog

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2025-01-25 Dirk Eddelbuettel <[email protected]>
2+
3+
* vignettes/rmd/Rcpp-libraries.Rdm: Add mention of PACKAGE_types.h
4+
* vignettes/rmd/Rcpp.bib: Add AsioHeaders
5+
* inst/bib/Rcpp.bib: Idem
6+
17
2025-01-18 Ben Bolker <[email protected]>
28

39
* inst/NEWS.Rd: fix trivial typos in NEWS file

inst/bib/Rcpp.bib

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ @Manual{CRAN:anytime
8080
url = CRAN # "package=anytime"
8181
}
8282

83+
@Manual{CRAN:AsioHeaders,
84+
title = {'Asio' C++ Header Files},
85+
author = {Dirk Eddelbuettel},
86+
year = {2024},
87+
note = {R package version 1.22.1},
88+
url = CRAN # "package=AsioHeaders"
89+
}
90+
8391
@Manual{CRAN:BH,
8492
title = {BH: Boost C++ Header Files},
8593
author = {Dirk Eddelbuettel and John W. Emerson and Michael

vignettes/rmd/Rcpp-libraries.Rmd

+18-9
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,24 @@ it.
154154

155155
Given a basic package with C++ support, we can now turn to integrating the external
156156
package. This complexity of this step can, as alluded to earlier, vary from very easy to
157-
very complex. Simple cases include just depending on library headers which can either
158-
be copied to the package, or be provided by another package such as \pkg{BH}
159-
\citep{CRAN:BH}. It may also be a dependency on a fairly standard library available on
160-
most if not all systems. The graphics formats bmp, jpeg or png may be example; text
161-
formats like JSON or XML are another. One difficulty, though, may be that _run-time_
162-
support does not always guarantee _compile-time_ support. In these cases, a `-dev` or
163-
`-devel` package may need to be installed.
164-
165-
In the concrete case of Corels, we
157+
very complex. Simple cases include just depending on library headers which can either be
158+
copied to the package, or be provided by another package such as \pkg{BH} \citep{CRAN:BH}
159+
or \pkg{AsioHeaders} \citep{CRAN:AsioHeaders} or many other examples.
160+
161+
One aspect worth noting is that if you include a type in your function interface it will
162+
also be part of the generated \code{RcppExports.cpp}. In this case adding a file
163+
\code{PACKAGE\_types.h} (where \code{PACKAGE} is to be replaced with the name of your
164+
package) containing the required \code{\#include} statement for the type(s) will permit
165+
compilation; see the 'Rcpp Attributes' vignette for details \citep{CRAN:Rcpp:Attributes}.
166+
167+
It may also be a dependency on a fairly standard library available on most if
168+
not all systems. The graphics formats bmp, jpeg or png may be an example; text
169+
formats like JSON or XML are another. One difficulty, though, may be that
170+
_run-time_ support does not always guarantee _compile-time_ support. In these
171+
cases, a `-dev` or `-devel` package may need to be installed.
172+
173+
Here, we use a third approach and copy files. Discussing the two other means
174+
fully is beyond the scope of this shorter note. So in the concrete case of Corels, we
166175

167176
- copied all existing C++ source and header files over into the `src/` directory;
168177
- renamed all header files from `*.hh` to `*.h` to comply with an R preference;

vignettes/rmd/Rcpp.bib

+8
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ @Manual{CRAN:anytime
8080
url = CRAN # "package=anytime"
8181
}
8282

83+
@Manual{CRAN:AsioHeaders,
84+
title = {'Asio' C++ Header Files},
85+
author = {Dirk Eddelbuettel},
86+
year = {2024},
87+
note = {R package version 1.22.1},
88+
url = CRAN # "package=AsioHeaders"
89+
}
90+
8391
@Manual{CRAN:BH,
8492
title = {BH: Boost C++ Header Files},
8593
author = {Dirk Eddelbuettel and John W. Emerson and Michael

0 commit comments

Comments
 (0)