73 results for "dynamic":

Thumbnail for The builder pattern, and a macro that keeps FFI code DRY

The builder pattern, and a macro that keeps FFI code DRY

everything still works. Mass dynamic loading In part 5, we said we’d have to come back to src/icmp/icmp_sys.rs at some point in the future. That point is now. As a reminder, here’s a short section of it: pub type Handle = *const c_void; use crate::loadlibrary::Library; type IcmpCreateFile = extern "stdcall" fn() -> Handle; pub fn

Ludum Dare #25 Post-mortem

playMusic("jazz-piano.ogg") But I had to do everything by hand as well. Wait, there’s more! Before starting LD, I did a ‘game framework’ with message passing between fully dynamic objects, called doll. I started developing the initial version with that, but then quickly realized it wasn’t going to cut it: defining ‘prototypes’ from
Thumbnail for A simple ping library, parsing strings into IPv4 address

A simple ping library, parsing strings into IPv4 address

left IcmpCreateFile unimplemented. We know we’re not going to be implementing it ourselves, it’s actually provided by IPHLPAPI.dll. But we also know we can’t just do: // in `src/icmp/icmp_sys.rs` extern "stdcall" { pub fn IcmpCreateFile() -> Handle; } ..because then our program won’t link. We’ve been using LoadLibrary to dynamically
Thumbnail for A no_std Rust binary

A no_std Rust binary

In Part 11, we spent some time clarifying mechanisms we had previously glossed over: how variables and functions from other ELF objects were accessed at runtime. We saw that doing so “proper” required the cooperation of the compiler, the assembler, the linker, and the dynamic loader. We also learned that the mechanism for functions was actually
Thumbnail for Day 14 (Advent of Code 2022)

Day 14 (Advent of Code 2022)

can be used from a Rust binary (our src/main.rs), and the “cdylib” part is for WebAssembly. It’s not really C, and it’s not really a dynamic library, but toolchains do be like that sometimes. We’ll need to expose some functions to wasm: // in `src/lib.rs` use wasm_bindgen::{prelude::*, JsCast}; #[wasm_bindgen] pub struct Grid
Thumbnail for Everything but ELF

Everything but ELF

first program header in memory pub const PHDR: Self = Self(3); // Number of program headers pub const PHNUM: Self = Self(5); // Address where the interpreter (dynamic loader) is mapped pub const BASE: Self = Self(7); // Entry point of program pub const ENTRY: Self = Self(9); } impl fmt::Debug for AuxvType { fn fmt
Thumbnail for Face cams: the missing guide

Face cams: the missing guide

shades, it’s also different colorspaces (Rec.2020 vs Rec.709 for HD SDR content, and let’s not talk about SD content). In this context: HD = “high definition” SD = “standard definition” HDR = “high dynamic range” SDR = “standard dynamic range” And it’s also different brightness standards: the brightest white on a properly
Thumbnail for Day 18 (Advent of Code 2022)

Day 18 (Advent of Code 2022)

ran into was that, on some platforms with some compilers, some of the executables (both C++ and Rust) did a lil’ stack overflow. On Windows, fixing it was a simple editbin /STACK:4194304 away, but we also tried using the stacker crate to grow it dynamically: it has to go around the self.dfs_lava recursive call. Apart from that, here’s some of
Thumbnail for From Inkscape to poppler

From Inkscape to poppler

directories = ["../../gir-files", "../gir-files"] work_mode = "sys" external_libraries = [ "Gio", "GLib", "GObject", "Cairo", ] ignore = [ "Poppler.MAJOR_VERSION", "Poppler.MINOR_VERSION", "Poppler.MICRO_VERSION", ] MAJOR_VERSION etc. are defines in C. Because we link dynamically against poppler in most scenarios, and the binding is
Thumbnail for Porting poppler to meson

Porting poppler to meson

on Windows, closed in favor of a similar MR) glib (work in progress, involves thread-local storage and dynamic linker/loader cursedness) In the current state of things, I have: a fork of glib, a (tiny) fork of cairo, and a whole set of meson build files for poppler… and it’s really easy to build for both Windows & Linux! All of the following