RCall.jl icon indicating copy to clipboard operation
RCall.jl copied to clipboard

Size mismatch in definition of SxpPtrInfo in src/types.jl

Open dmbates opened this issue 2 months ago • 1 comments

Near the beginning of src/types.jl the SxpPtrInfo type is defined as UInt32. I think that is out of date. Current versions of the "R Internals" manual state

Both types of node structure have as their first three fields a 64-bit sxpinfo header and then three pointers (to the attributes and the previous and next node in a doubly-linked list), and then some further fields.

I believe that things work out because the manipulations of later fields, like attributes, and getting data pointers (dataptr) are performed through calls to C functions in libR.

I can try out changing this to UInt64 and seeing if anything breaks but I first to ask if others understand the R Internals document the same way I do.

(If I am right, then RCall.jl will fail on big-endian systems because the SEXPTYPE code is in the first five bytes of the SxpPtrInfo. These happen to be in the same position on little-endian systems for UInt32 and UInt64, but not on big-endian systems. And if you are asking yourself, "Why would anyone care about big-endian systems? No one uses them." then you obviously haven't submitted a large, complex package to CRAN.)

dmbates avatar Oct 24 '25 21:10 dmbates

I certainly have never submitted a large, complex package to CRAN (nor any package, for that matter), though I've heard... stories... about the experience. RCall.jl will fail on big-endian systems anyway though because Julia doesn't support any big-endian systems.

ararslan avatar Nov 06 '25 02:11 ararslan