Marcin Kolenda
Marcin Kolenda

Reputation: 28

How to memory map a file in Common Lisp on Linux?

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.

Upvotes: 1

Views: 679

Answers (2)

zut
zut

Reputation: 816

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.

Upvotes: 1

Svante
Svante

Reputation: 51501

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.

Upvotes: 7

Related Questions