Skip to content

Building the DLL

Tagin T edited this page Sep 4, 2026 · 1 revision

Building the DLL

Most users never build the native library — the wheel bundles vulkan_core.dll. Build it from source only if you are developing the renderer or testing native changes.

Requirements

  • Visual Studio 2022 (MSVC cl.exe) or another C compiler with the same C11 toolchain
  • Vulkan SDK (headers under Include/, vulkan-1.lib under Lib/)
  • Windows

Scripts in native/

Script Output Notes
build.ps1 build/{release,debug}/*.o and dist/{release,debug}/vulkan_core.dll Canonical PowerShell build. .\build.ps1 (release) or .\build.ps1 debug.
build_msvc.bat native/vulkan_core_msvc.dll Single-command MSVC build via cl.exe (calls vcvars64.bat).

PowerShell build

cd native
.\build.ps1          # release  -> dist/release/vulkan_core.dll
.\build.ps1 debug    # debug    -> dist/debug/vulkan_core.dll

The script locates the newest Vulkan SDK under its install root, compiles platform.c, vulkan_init.c, vulkan_draw.c and every draw/*.c, then links against vulkan-1.lib, user32.lib and gdi32.lib.

MSVC single-command build

cmd /c build_msvc.bat

Using the freshly built DLL

When running from source, the loader looks for vulkan_core.dll beside the package. Copy the build output into place:

# PowerShell / cmd
copy dist\release\vulkan_core.dll ..\real_time_manim\vulkan_core.dll

(vulkan_core_msvc.dll from build_msvc.bat is copied the same way.)

What the DLL contains

The native layer is split into a handful of translation units:

File Responsibility
platform.h/.c Win32 window, DLL entry, shape command buffers, frame loop hooks
vulkan_core.h Global Vulkan state declarations
vulkan_init.c Vulkan instance, device, swapchain, pipeline setup (VK_USE_PLATFORM_WIN32_KHR)
vulkan_render.h Render API (DrawCmd, Render_DrawScene)
vulkan_draw.c Vertex generation + GPU submission
shared_types.h Shape structs (Rect, Circle, Line, …)
draw_common.h NDC conversion + vertex push helpers
stb_truetype.h TrueType font rasterizer (stb)
draw/*.c Per-shape vertex builders (rect, circle, line, ellipse, polygon, arc, bezier, text, dashed_line, point)

Exported DLL functions

// Lifecycle
int  Vulkan_Init(int w, int h);          // create window + init Vulkan
int  Vulkan_Tick(void);                  // process messages; return dimensions
void Vulkan_Shutdown(void);              // cleanup

// Shape submission
void AddRect(...);        void AddCircle(...);        void AddLine(...);
void AddEllipse(...);     void AddPolygon(...);       void AddDashedLine(...);
void AddArc(...);         void AddPoint(...);         void AddText(...);
void AddBezierPath(...);

// Font loading
int  Text_LoadFont(const unsigned char* data, int len);

// Screenshot
int  SaveScreenshot(const char* path);
void ClearShapes(void);

Clone this wiki locally