Remix.run Logo
immibis 3 days ago

The same is true of DLLs. They don't do anything by themselves; they are merely blocks of bytes mapped into memory.

Why is tracking the lifetime of a function pointer different from tracking the lifetime of any other pointer?

FreeLibrary on Windows unloads libraries when the reference count is zero.

SkiFire13 15 hours ago | parent [-]

> The same is true of DLLs. They don't do anything by themselves; they are merely blocks of bytes mapped into memory.

FYI just loading a DLL can execute code.

> Why is tracking the lifetime of a function pointer different from tracking the lifetime of any other pointer?

Technically speaking none, but historically this is something that nobody did, so we are full of code that assumes function pointers to have a static lifetime. It's a social problem.