knitr::opts_chunk$set(echo = TRUE)
# save vignettes/mini.c void useC(int *i){ i[0] = 11; }
R CMD SHLIB vignettes/mini.c
C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 - Wall -std=gnu99 -mtune=generic -c vignettes/mini.c -o vignettes/mini.o C:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o vignettes/mini.dll tmp.def vig nettes/mini.o -LC:/PROGRA~1/R/R-36~1.1/bin/x64 -lR
dyn.load("vignettes/mini.dll")
a <- rep(2, 10) # integer vector a
[1] 2 2 2 2 2 2 2 2 2 2
out <- .C("useC", b = as.integer(a)) out$b
[1] 11 2 2 2 2 2 2 2 2 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.