From fbc2679fc325c2e3cde4a6de341e93d3492e6d5c Mon Sep 17 00:00:00 2001 From: IoIxD Date: Fri, 17 Jul 2026 19:36:17 -0700 Subject: [PATCH] Sure we'll dynload CoInitialize --- src/text/directwrite.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/text/directwrite.c b/src/text/directwrite.c index 888e92c5..df584ac6 100644 --- a/src/text/directwrite.c +++ b/src/text/directwrite.c @@ -532,6 +532,20 @@ static CustomTextRenderer* CustomTextRenderer_Create(IDWriteFactory6* write_fact int MWFL_DWSetup(void) { HRESULT hr; + HANDLE ole32lib; + /* CoInitialize, to my knowledge, is avaliable on every Windows version we actually support. But as of writing, CI fails because a specific mingw won't link to it by default. I'm not gonna waste my time chancing that it will properly link to ole32 either. */ + HRESULT (*CoInitialize)(LPVOID pvReserved); + + ole32lib = LoadLibrary("Ole32.dll"); + if(!ole32lib) { + printf("ole32lib not found, cannot use DirectWrite\n"); + return 1; + } + CoInitialize = (HRESULT (*)(LPVOID pvReserved))GetProcAddress(ole32lib, "CoInitialize"); + if(!CoInitialize) { + printf("CoInitialize not found, cannot use DirectWrite\n"); + return 1; + } CoInitialize(NULL);