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);