| Copyright | (c) 2026 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@ppad.tech> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Censor.Runner.DL
Description
Minimal dlopen/dlsym bindings for driving a foreign
constant-time target that lives in a shared library. Used by the
censor executable to resolve a symbol at runtime and hand it to
Censor.FFI as an ffiTarget.
The underlying handle is opened with RTLD_NOW | RTLD_LOCAL: any
unresolved symbols surface immediately (so bad shims are caught at
withLibrary entry, not at first call), and the library's own
symbols do not pollute the global namespace. Not available on
Windows.
Library handle
An opened shared library. Bracketed by withLibrary; do not
retain the value past its callback.
withLibrary :: FilePath -> (Library -> IO a) -> IO a Source #
Open a shared library for the duration of the callback and close
it on exit. Throws DLOpenFailed if the library cannot be
loaded.
Resolving targets
resolveTarget :: Library -> String -> IO (Ptr Word8 -> IO ()) Source #
Resolve a symbol as a void(uint8_t *) target action. Throws
DLSymFailed if the symbol is absent from the library.
The resolved FunPtr is not retained past the enclosing
withLibrary scope; do not call the returned action after the
library has been closed.
Errors
Why a dynamic-linker operation failed. The String payload is
the dlerror message at the moment of failure.
Constructors
| DLOpenFailed !FilePath !String |
|
| DLSymFailed !String !String |
|
Instances
| Exception DLError Source # | |
Defined in Censor.Runner.DL Methods toException :: DLError -> SomeException # fromException :: SomeException -> Maybe DLError # displayException :: DLError -> String # backtraceDesired :: DLError -> Bool # | |
| Show DLError Source # | |
| Eq DLError Source # | |