On Thu, 02 Dec 2021 19:13:17 +0100 Andreas Rheinhardt <andreas.rheinha...@outlook.com> wrote: > Lynne: > > The issue is that if ffmpeg is compiled without Vulkan, and an API > > user includes and uses the functions exposed in hwcontext_vulkan.h, > > then a linking error will happen, as the hwcontext_vulkan.c file has > > not been compiled. > > > > Move the functions to another file, and make it always compiled. The > > functions do not use any Vulkan functions. > > > > Patch attached. > > > > > > 1. Isn't a linking error exactly what is intended in such cases? > 2. And even if not: Actually compiling the whole implementation is > unnecessary; in such cases we typically #if everything away (e.g. in > your case: it will always return NULL). > 3. The hwcontext_vulkan.h header requires vulkan system headers; you > can't compile this without it.
Hi, I have a motivating use case: a single header library which needs to conditionally use these functions only if they're supposed. My first instinct was to test if the header is available/included, but that doesn't work, because ffmpeg unconditionally installs it even if it's not compiled (IMO wrong behavior). If the only way to know whether or not the header works, is to perform a build-time check to see if the functions link, that uncomfortably shifts responsibility onto the API user of my library to perform this check on their end before including my (single header) library. This was one proposed work-around, which is to make them always link but return a runtime error if FFmpeg was compiled without vulkan support. I agree that in this case the entire file should be #if'd out and the signatures implemented by stub functions that only return the necessary error, with no build-time dependency on vulkan.h. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".