1% File src/library/utils/man/LINK.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2018 R Core Team
4% Distributed under GPL 2 or later
5
6\name{LINK}
7\alias{LINK}
8\title{Create Executable Programs on Unix-alikes}
9\description{
10  Front-end for creating executable programs on unix-alikes, i.e., not
11  on Windows.
12}
13\usage{
14\special{R CMD LINK [options] linkcmd}
15}
16\arguments{
17  \item{linkcmd}{a list of commands to link together suitable object
18    files (include library objects) to create the executable program.}
19  \item{options}{further options to control the linking, or for
20    obtaining information about usage and version.}
21}
22\details{
23  The linker front-end is useful in particular when linking against the
24  \R shared or static library: see the examples.
25
26  The actual linking command is constructed by the version of
27  \command{libtool} installed at \file{\env{R_HOME}/bin}.
28
29  \command{R CMD LINK --help} gives usage information.
30}
31\note{
32  Some binary distributions of \R have \code{LINK} in a separate
33  bundle, e.g.\sspace{}an \code{R-devel} RPM.
34
35  This is not available on Windows.
36}
37\seealso{
38  \code{\link{COMPILE}}.
39}
40\examples{\dontrun{## examples of front-ends linked against R.
41## First a C program
42CC=`R CMD config CC`
43R CMD LINK $CC -o foo foo.o `R CMD config --ldflags`
44
45## if Fortran code has been compiled into ForFoo.o
46FLIBS=`R CMD config FLIBS`
47R CMD LINK $CC -o foo foo.o ForFoo.o `R CMD config --ldflags` $FLIBS
48
49## And for a C++ front-end
50CXX=`R CMD config CXX`
51R CMD COMPILE foo.cc
52R CMD LINK $CXX -o foo foo.o `R CMD config --ldflags`
53}}
54\keyword{utilities}
55