demo/factorial.R

f <- function(i,fun)
{
  if (i > 1) i * .dyncall(fun,"ip)i",i-1,fun) else i
}
e <- new.env()
cb <- new.callback("ip)i", f,e)
e <- NULL
f <- NULL
gc()
r <- .dyncall(cb,"ip)i",12,cb)
r == factorial(12)
cb <- NULL
gc()

Try the rdyncall package in your browser

Any scripts or data that you put into this service are public.

rdyncall documentation built on May 2, 2019, 6:15 p.m.