Skip to content

ERL-1475: Allow erlang:load_nif in archives #4476

Description

@OTP-Maintainer

Original reporter: lukas
Affected version: Not Specified
Component: erts
Migrated from: https://bugs.erlang.org/browse/ERL-1475


We want to be able to load nif code from archives.

The fallback approach to this would be to create a temp file that we dlopen and then unlink directly afterward.

For most platforms, we should be able to load the memory directly by using some platform specific features/hacks:

Linux: memfd_create + dlopen of /proc/self/fd/%d
Windows: https://github.com/py2exe/py2exe/blob/master/source/MyLoadLibrary.c
OS X:  https://stackoverflow.com/questions/11821955/load-dynamic-library-from-memory
FreeBSD/DragonFly: https://www.freebsd.org/cgi/man.cgi?query=fdlopen&sektion=3,
Android: https://github.com/google/iree/issues/3845

There is also a bit of discussion here: https://github.com/erlang/otp/pull/3002

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions