Skip to main content
Inspiring
August 13, 2017
Question

Cairo: avoid using dll on windows?

  • August 13, 2017
  • 1 reply
  • 3005 views

Hi. I'm using cairo and on mac everything is fine, but on Windows I can't get my plugin to run if the cairo .dll is not next to afterFX.exe. I tried to feed visual studio a complete .lib for cairo and set it to MT instead of MD, but when I apply it AE gives an error about an invalid effect. Sounds like a dependency error from reading the previous posts.

So my question is, is it possible to give visual studio a .lib so it won't need a .dll? If so, I guess I haven't configured something correctly.

This topic has been closed for replies.

1 reply

August 13, 2017

There are two ways of linking on most operating systems: dynamic linking and static linking. Dynamic linking means you only link with a stub with the necessary function declarations, but not with the actual implementation. To run an application with such a dynamically linked library, its shared external object file (.dll on Windows, .so on MacOS and Linux, MacOS additionally also. dylib) needs to be present at runtime.

Static linking on the other hand takes the complete implementation code of the library and directly integrates it into your application on compilation/link time. It does therefore not need a shared library/DLL present when run.

Most third party libraries on most operating systems are available (or can be compiled) as dynamic or static versions, so make sure you link to the correct one. It seems you are currently linking to the dynamic Cairo version. Unfortunately, on Windows/Visual Studio, both variants have the .lib extension.

Inspiring
August 13, 2017

Thanks Toby, that's very helpful info. It seems likely that I just need to keep trying to build or download cairo as a static library and it should work.

Inspiring
November 28, 2021

believe the define is: CAIRO_WIN32_STATIC_BUILD

from this article: GitHub - DomAmato/Cairo-VS: Solution for compiling Cairo on Windows 32/64 bit


I dont think this solution works anymore. I want to use a non-vcpkg method for libcairo.lib - the default meson method builds libcairo.a on windows. Has anyone managed to build libcairo.lib on windows recently.