compileC function

Compile a C File into a Shared Library Object

Compile a C File into a Shared Library Object

This function provides an alternative to using R's SHLIB

command to compile C code into a shared library object.

compileC(file, lib="", options="", logWindow=TRUE, logFile=TRUE)

Arguments

  • file: name of the file to compile.
  • lib: name of shared library object (without extension).
  • options: linker options (in one string) to prepend to a compilation command.
  • logWindow: if TRUE, a log window containing the compiler output will be displayed.
  • logFile: if TRUE, a log file containing the compiler output will be created.

Details

If lib="", it will take the same name as file (with a different extension).

If an object with the same name has already been dynamically loaded in R, it will be unloaded automatically for recompilation.

The name of the log file, if created, uses the string value from lib

concatenated with ".log".

Author(s)

Anisa Egeli, Vancouver Island University, Nanaimo BC

See Also

loadC

Examples

## Not run: local(envir=.PBSmodEnv,expr={ cwd = getwd() edir <- system.file("examples", package = "PBSmodelling" ) file.copy(paste(edir,"fib.c",sep="/"), tempdir(), overwrite=TRUE) setwd(tempdir()) compileC("fib.c", lib="myLib", options="myObj.o", logWindow=FALSE) print(list.files()) setwd(cwd) }) ## End(Not run)