This is a slightly modified version of the standalone Rmath library from R, built to be used with the Rmath.jl Julia package.
The main difference is that it is built to allow defining custom random number generating
functions via C function pointers (see include/callback.h). When using the library,
these should be defined before calling any of the random functions.
Rmath-julia requires GNU Make (https://www.gnu.org/software/make). Just run
make to compile the library.
To update to the latest version of R, bump the RVERSION file, and run make update. Some additional manual changes to the headers may be necessary: these should go
in include/Rconfig.h (this would typically be generated by autotools, but we try to
simplify the build process). Please also check that declarations with _Thread_local are not dropped as part of the update, see #50.
Only mark a static variable _Thread_local if it is actually written to. Mutable
per-thread state adds to the library's static TLS segment, which on glibc older than
2.32 is drawn from a small, non-tunable per-process surplus shared with every other
shared library in the process — exhausting it makes unrelated libraries fail to load
with cannot allocate memory in static TLS block, see
#56. Read-only tables of coefficients
are already thread-safe, so marking them _Thread_local is misleading: at -O3 the
compiler folds them and it costs nothing, but it advertises per-thread state that does
not exist. rexpm1() in src/toms708.c and fact[] in src/rpois.c are examples.