o
odinpkg.dev
packages / library / hot-relodin

hot-relodin

f6e4df2library

An example of how to do hot code reloading with the Odin programing language.

No license · updated 2 years ago

HotRelodin

Courtesy of Karl Zylinkski's blog on how to do hot code reloading with Odin. Find his more comprehensive template here.

Requirements

Install the Odin programming language.

Steps

Build the game DLL:

odin build game -build-mode:dll -out:game.dll

Compile main and run it:

odin run main

In game/game.odin, modify game_update:

game_update :: proc() -> bool
{
-   memory.some_state += 1
+   memory.some_state -= 1
    fmt.println(memory.some_state)
    return true
}

Rebuild the game DLL:

odin build game -build-mode:dll -out:game.dll

Now you're "hot relodin"!

Compile in "release" mode

odin build main_release