API referencestd/dylib

std/dylib

Public declarations, types, methods, and source contracts for std/dylib.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/dylib"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
native std/dylib/native dylib.dodo
ptr core/ptr dylib.dodo

Error

Enum · Source

Why a library or symbol could not be used.

pub enum Error {
    // The name is empty, lacks its final NUL, or contains another NUL.
    InvalidName,
    // The system found no loadable library by that name.
    NotFound,
}

error_name

Function · Source

pub fn error_name(error: Error) -> &str from(static)

Library

Struct · Source

An open shared library. It stays loaded until close(), or for the rest of the process when it is dropped: code and data looked up in it may still be in use, which the library cannot know.

pub struct Library {
    // Private implementation fields omitted.
}

Library.symbol

Function · Source

The address of the exported symbol name, or null if the library has none. Reading or calling through it is unsafe: the caller must know the symbol’s actual type.

pub fn symbol(&self, name: &[u8]) -> *const u8!Error

Library.close

Function · Source

Unload the library. Unsafe: no address obtained from it may be used afterwards.

pub unsafe fn close(self)

Requires an unsafe context. Follow the source safety preconditions and the linked guide before calling this API.

open

Function · Source

Load the library name, searched for by the system’s rules: a bare name such as b“libvulkan.so.1\0” uses the dynamic linker’s search path, while a name containing a slash (a backslash on Windows) is a file path.

pub fn open(name: &[u8]) -> Library!Error

Search every guide, reference page, and API declaration.