Courtesy of ignis volens on SO: https://stackoverflow.com/questions/69675964/how-to-get-the-filename-where-a-function-is-defined-in-common-lisp/69677540#69677540
If what you seek is a portable solution – one that is written in portable CL – then the answer to that is to define wrappers for defining forms and then use the wrappers.
(defvar *flocs* (make-hash-table :test #'equal))
(defgeneric function-location (f/name)
(:method ((name t))