Skip to content

Finding the main module needs alloc #190

Closed as not planned
Closed as not planned

Description

@ero-qt

Process::get_main_module_range only exists with the alloc feature, because it gets the module's name from get_name, which returns a String. Without alloc, there's no way to find the game's executable.

That matters for Unity players that link the engine into the executable: Windows players before 2017.2, and Linux players before 2019.3. Mono and the scene manager read the Unity version from the engine module, so on those players they can't read it without alloc. Mono then attaches only if the exact build ID of its library is in the table, and the scene manager can't find the engine at all.

process_get_path already writes the path into a buffer the caller passes in, and it reports the length it needs when the buffer is too small. A buffer on the stack is enough to take the file name after the last / and look the module up by it, so the main module lookup wouldn't need alloc. The process_get_path import itself is only behind alloc by its cfg.

How long should that buffer be? Linux allows paths up to 4096 bytes, and I'd rather not put 4 KiB on the stack without asking.

Activity

  1. ero-qt commented on Oct 10, 2026

    @ero-qt
    ContributorAuthor

    #187 makes the automatic Mono attach methods require alloc instead of using a fixed-size path buffer (details), so this isn't needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions