PBSmodelling (version 2.68.8)

compileC: Compile a C File into a Shared Library Object

Description

This function provides an alternative to using R's SHLIB command to compile C code into a shared library object.

Usage

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.

Author

Anisa Egeli, Vancouver Island University, Nanaimo BC

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".

See Also

loadC

Examples

Run this code
if (FALSE) {
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)
})
}

Run the code above in your browser using DataCamp Workspace