HappySeaFox / sail

The missing small and fast image decoding library for humans (not for machines) ⛵ https://sail.software
MIT License
307 stars 22 forks source link

When building SAIL as dynamic library with VCPKG it is built as a static library #214

Open Murk42 opened 1 month ago

Murk42 commented 1 month ago

I'm using Visual Studio with its VCPKG integration in manifest mode. In the project properties "Configuration Properties/vcpkg/Use Static Libraries" is set to "No". With this setup I get a linker error like: error LNK2019: unresolved external symbol __imp_sail_init referenced in function "struct Blaze::TimingResult __cdecl Blaze::InitializeSail(void)" (?InitializeSail@Blaze@@YA?AUTimingResult@1@XZ)

With a quick google search I found out "__impl" prefix is added to a function when it is searched for from a DLL. But because it couldn't link I realized that SAIL was built as a static library.

For a quick fix I added SAIL_STATIC before my include and manually included SAIL .lib files in the project properties and everything compiled right.

The thing I don't understand is why are SAILL .dll files still generated, if the .lib file is a static library?

HappySeaFox commented 1 month ago

Hi! It might be a vcpkg feature as SAIL generates just the files you ask to generate. In dynamic mode it generates dll+small lib files, in static mode it generates just large lib files. Make sure you use the right vcpkg triplet as well (vcpkg install --triplet x64-windows-static for example). I've never used the vcpkg manifest mode so I may not be immediately ready to test it locally. It would be great if you create a small standalone project just to reproduce the issue and attach it here.