0

How can I achieve memory mapping in Common Lisp either through cffi or a custom library?

There is void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); in C language.

  • 3
    Duplicate? https://stackoverflow.com/questions/27451190/how-do-i-memory-map-tmpfs-files-in-sbcl SBCL has a `mmap` in `sb-posix`. – Ehvince Nov 16 '19 at 13:41

2 Answers2

6

There is already How do I memory map tmpfs files in sbcl?, but nowadays there is a portable library for that: just (ql:quickload "mmap").

The repository is here.

Svante
  • 50,694
  • 11
  • 78
  • 122
1

Some implementations let you specify in a call to function open take the file should be memory-mapped. At least Allegro CL supports (open .. :mapped t). This also works in macro with-open-file which expands into open.

zut
  • 806
  • 4
  • 12