From 9c46956fd784c6985867aca069b926d774602928 Mon Sep 17 00:00:00 2001 From: ripley Date: Wed, 19 Jul 2023 10:43:01 +0000 Subject: [PATCH] mention forcing linking by C++ git-svn-id: https://svn.r-project.org/R/trunk@84706 00db46b3-68df-0310-9c12-caf00c1e9a41 --- doc/manual/R-exts.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/manual/R-exts.texi b/doc/manual/R-exts.texi index e6f7b71ea4e..a828cfa4ec3 100644 --- a/doc/manual/R-exts.texi +++ b/doc/manual/R-exts.texi @@ -3120,6 +3120,17 @@ C++17 as from @R{} 3.4.0, for C++20 from @R{} 4.0.0 and for C++23 from @R{} 4.3.0 (although they may not be supported by the compilers in use). C++11 support became mandatory in @R{} 4.0.0. +The @file{.so}/@file{.dll} in a package may need to be linked by the +C++ compiler if it or any library it links to contains compiled C++ +code. Dynamic linking usually brings in the C++ runtime library +(commonly @code{libstdc++} but can be, for example, @code{libc++}) but +static linking (as used for external libraries on Windows and macOS) +will not. @command{R CMD INSTALL} will link with the C++ compiler if +there are any top-level C++ files in @file{src}, but not if these are +all in subdirectories. The simplest way to force linking by the C++ +compiler is to include an empty C++ file in @file{src}, as used by +package @pkg{rgeos}. + @node C standards, Using @command{cmake}, Using C++ code, Configure and cleanup @subsection C standards