Reference page
Non-API R Functions Tracking
This document tracks usage of non-API R functions in miniextendr. Non-API functions are detected by R CMD check via tools:::.checksosymbols.
This document tracks usage of non-API R functions in miniextendr.
Non-API functions are detected by R CMD check via tools:::.check_so_symbols.
Reference: https://svn.r-project.org/R/trunk/src/library/tools/R/sotools.R
πCurrently Used Non-API Functions
| Function | Location | Feature Gate | Notes |
|---|---|---|---|
| (none currently) |
πFeature-Gated Non-API Functions
Locations intentionally omit line numbers (they drift); use search on the symbol name.
| Function | Location | Feature Gate | Notes |
|---|---|---|---|
DATAPTR | miniextendr-api/src/ffi.rs | nonapi | Mutable data pointer - prefer DATAPTR_RO or DATAPTR_OR_NULL |
R_curErrorBuf | miniextendr-api/src/ffi.rs | nonapi | Current error message buffer - used for better error messages from worker thread |
R_CStackStart | miniextendr-api/src/ffi.rs (nonapi_stack) | nonapi | Stack top address - needed for thread safety |
R_CStackLimit | miniextendr-api/src/ffi.rs (nonapi_stack) | nonapi | Stack limit - set to usize::MAX to disable checking |
R_CStackDir | miniextendr-api/src/ffi.rs (nonapi_stack) | nonapi | Stack growth direction (-1 = down, 1 = up) |
ptr_R_WriteConsoleEx | miniextendr-api/src/progress.rs | indicatif (implies nonapi) | R console hook used by indicatif TermLike backend |
Note: miniextendr-engine is entirely non-API (uses Rembedded.h/Rinterface.h for embedding R) and is not tracked here.
πTest Utilities (Not Part of R Package)
The file miniextendr-api/tests/r_test_utils.rs contains a disable_r_stack_checking() function
that directly accesses R_CStackLimit. This code is never part of the R package because:
- Itβs in the
tests/directory ofminiextendr-api, which is only compiled forcargo test - It uses
miniextendr-engineto embed R for Rust unit tests - The example R package (
rpkg/) only vendorsminiextendr-api/src/andminiextendr-macros/src/ - Test directories are excluded from vendoring
This test utility exists because cargo test embeds R in a non-standard way (not via R CMD),
and Rβs stack checking needs to be disabled to prevent false positives on worker threads.
πAPI Functions (Safe to Use)
These functions are NOT in the non-API list and are safe:
| Function | Status |
|---|---|
DATAPTR_RO | API (safe) |
DATAPTR_OR_NULL | API (safe) |
R_ExternalPtrAddr | API (safe) |
R_ExternalPtrTag | API (safe) |
R_ExternalPtrProtected | API (safe) |
R_MakeExternalPtr | API (safe) |
Rf_allocVector | API (safe) |
Rf_protect / Rf_unprotect | API (safe) |
Rf_install | API (safe) |
Rf_xlength | API (safe) |
STRING_ELT | API (safe) |
R_CHAR | API (safe) |
TYPEOF | API (safe) |
πFull Non-API List (R 4.5.x trunk)
Click to expand complete list
πObsolete
chol_,chol2inv_,cg_,ch_,rg_fft_factor,fft_work,Brent_fmin,optif0
πNon-API in headers or no header
OutDec,PRIMOFFSET,RC_fopen,R_CollectFromIndexR_CompiledFileName,R_FileExistsR_FreeStringBuffer,R_FunTab,R_GE_setVFontRoutinesR_GetVarLocMISSING,R_MethodsNamespace,R_NewHashedEnvR_OpenCompiledFile,R_PV,R_ParseContextR_ParseContextLast,R_ParseContextLineR_ParseError,R_ParseErrorMsg,R_SrcfileSymbolR_SrcrefSymbol,R_Visible,R_addTaskCallbackR_cairoCdynload,R_data_classR_deferred_default_method,R_execMethodR_findVarLocInFrame,R_fopen,R_gc_tortureR_getTaskCallbackNames,R_get_arith_functionR_gzclose,R_gzgets,R_gzopen,R_ignore_SIGPIPER_isForkedChild,R_isMethodsDispatchOnR_moduleCdynload,R_primitive_genericR_primitive_methods,R_print,R_removeTaskCallbackR_running_as_main_program,R_setInternetRoutinesR_setLapackRoutines,R_setX11RoutinesR_set_prim_method,R_set_quick_method_checkR_set_standardGeneric_ptr,R_strtod4R_subassign3_dflt,R_taskCallbackRoutineRconn_fgetc,Rconn_printf,RdownloadRf_EncodeComplex,Rf_EncodeElementRf_EncodeEnvironment,Rf_EncodeIntegerRf_EncodeLogical,Rf_EncodeReal,Rf_GPrettyRf_NewEnvironment,Rf_PrintDefaultsRf_ReplIteration,Rf_Seql,Rf_addTaskCallbackRf_begincontext,Rf_callToplevelHandlersRf_checkArityCall,Rf_con_pushbackRf_copyMostAttribNoTs,Rf_deparse1,Rf_deparse1lineRf_dpptr,Rf_endcontext,Rf_envlengthRf_formatComplex,Rf_formatIntegerRf_formatLogical,Rf_formatReal,Rf_init_conRf_isProtected,Rf_mbrtowc,Rf_mkFalseRf_printNamedVector,Rf_printRealVectorRf_printVector,Rf_removeTaskCallbackByIndexRf_removeTaskCallbackByName,Rf_set_iconvRf_sortVector,Rf_strIsASCII,Rf_strchrRf_strrchr,Rf_ucstomb,Rf_utf8towcsRf_wcstoutf8,Rg_PolledEvents,Rg_set_col_ptrsRf_wait_usec,Ri18n_*,Rsock*,RunzipUNIMPLEMENTED_TYPE,baseRegisterIndexRf_csduplicated,Rf_currentTimedcar,dcdr,do_*,dqrrsd_,dqrxb_,dtypedummy_*,epslon_,extR_*,fdhessgetConnection,getPRIMNAME,known_to_be_latin1locale2charset,match5,matherrmax_contour_segments,Rf_mbcsToUcs2,Rf_memtrace_reportparseError,pythag_,rs_,rwarnc_tql2_,tqlrat_,tred1_,tred2_,utf8locale,yyllocR_opendir,R_readdir,R_closedir
πRinternals.h non-API
ENSURE_NAMEDMAX,IS_ASCII,IS_UTF8,SET_PRSEEN,ddfindSET_TYPEOF,SET_OBJECT,SET_S4_OBJECT,UNSET_S4_OBJECTSETLENGTH,SET_TRUELENGTH,SETLEVELSSET_ENVFLAGS,SET_FRAME,SET_ENCLOS,SET_HASHTABSET_PRENV,SET_PRVALUE,SET_PRCODE,STDVEC_DATAPTRIS_GROWABLE,SET_GROWABLE_BIT,SET_NAMEDR_PromiseExpr,R_tryWrapDDVAL,NAMED,INTERNAL,SYMVALUE,PRSEENINTEGER0,LOGICAL0,RAW0,REAL0,COMPLEX0LEVELS,FRAME,HASHTAB,ENVFLAGS,RDEBUG,SET_RDEBUGSTRING_PTR,VECTOR_PTR,DATAPTR,STDVEC_DATAPTRSET_FORMALS,SET_BODY,SET_CLOENV,Rf_findVarInFrame3PRCODE,PRENV,PRVALUE,R_ncharRf_NonNullStringMatch,TRUELENGTH,XLENGTH_EXXTRUELENGTH,Rf_gsetVarRf_isValidString,Rf_isValidStringFR_shallow_duplicate_attrEXTPTR_PROT,EXTPTR_TAG,EXTPTR_PTROBJECT,IS_S4_OBJECTRf_allocSExp,Rf_isFrameBODY,FORMALS,CLOENV,ENCLOSR_Pretty
πRinterface.h / Rembedded.h non-API
AllDevicesKilled,R_CStackLimit,R_CStackStartR_ClearerrConsole,R_CleanTempDir,R_ConsolefileR_DefCallbacks,R_DefParams,R_DefParamsExR_DirtyImage,R_GUIType,R_GlobalContextR_HistoryFile,R_HistorySize,R_Home,R_HomeDirR_Interactive,R_OutputfileR_PolledEvents,R_ReplDLLdo1,R_ReplDLLinitR_RestoreGlobalEnv,R_RestoreGlobalEnvFromFileR_RestoreHistory,R_RunExitFinalizers,R_SaveGlobalEnvR_SaveGlobalEnvToFile,R_SelectEx,R_SetParamsR_SetWin32,R_SignalHandlers,R_SizeFromEnv,R_NoEchoR_Suicide,R_TempDir,R_checkActivityR_checkActivityEx,R_runHandlersR_setStartTime,R_set_command_line_argumentsR_setupHistory,R_timeout_handler,R_timeout_valR_wait_usec,RestoreAction,Rf_CleanEdRf_KillAllDevices,Rf_endEmbeddedR,Rf_initEmbeddedRRf_initialize_R,Rf_jump_to_toplevel,Rf_mainloopSaveAction,editorcleanall,fpu_setupfreeRUser,free_R_HOMEgetDLLVersion,getRUser,get_R_HOMEgetSelectedHandler,initStdinHandlerprocess_site_Renviron,process_system_Renvironprocess_user_Renviron,ptr_R_*readconsolecfg,run_Rmainloop,setup_Rmainloop
πR_ext/Connections.h non-API
R_new_custom_connection,R_ReadConnectionR_WriteConnection,R_GetConnection
πDeprecated/removed
call_R(removed in R 4.5.0)Rf_setSVector
πFeature Gate Strategy
When using non-API functions, wrap them in a nonapi feature:
#[cfg(feature = "nonapi")]
pub fn DATAPTR(x: SEXP) -> *mut c_void;
This allows users to opt-in to non-API usage while keeping the default build CRAN-compatible.