Lisp integers cannot be used directly in the FLI unless they are known to be of certain sizes that match foreign types such as :int.
However, the FLI provides a mechanism to convert any Lisp integer into a foreign array of bytes and to convert that array back to an equivalent Lisp integer. This would allow the integer to be stored in an database for example and then retrieved later.
The macro with-integer-bytes and the function convert-integer-to-dynamic-foreign-object generates the array of bytes and also to determine its length. The function make-integer-from-bytes converts the foreign array back to an integer. The layout of the bytes is unspecified, so these operations must be used for all such conversions.
Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:57