Returns an external pointer to the underlying data (INTEGER, REAL, etc.) while ensuring the object won't be garbage collected.
Details
Note: For ALTREP objects (like 1:10), use data_ptr_ro() instead,
which properly handles deferred materialization.
Examples
if (FALSE) { # \dontrun{
x <- c(1.0, 2.0, 3.0) # Regular vector, not ALTREP
ptr <- data_ptr(x)
# ptr points to the double* array
# Safe to pass to C functions expecting double*
} # }