24 lines
626 B
C++
24 lines
626 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace voidlibc::loader::macos_handoff {
|
|
|
|
struct LoadResult {
|
|
void* dl_handle = nullptr;
|
|
std::string error;
|
|
bool ok = false;
|
|
};
|
|
|
|
// Write `blob` to a per-process temp file under $TMPDIR and call dlopen on it.
|
|
// The temp file is unlinked after dlopen succeeds (the mapping keeps the data alive).
|
|
// Returns a native dlopen handle on success.
|
|
LoadResult dlopen_buffer(const std::vector<std::uint8_t>& blob);
|
|
|
|
void* sym(void* handle, const char* name);
|
|
int close_(void* handle);
|
|
|
|
} // namespace voidlibc::loader::macos_handoff
|