Cflags.private field. This field is required dor linking on Windows for all libraries exposing variables, since Windows requires a special
__declspec(dllimport) attribute to be set on declaration of variables defined in shared libraries; if this attribute is set but the variable is actually defined in a static lib or it's not set and it is defined in a shared lib the linker errors out.
With this flag affected libraries can define a macro in
Cflags.private and hide the
dllimport attribute behind an
#ifdef in their public headers.
This was originally brought up in #38 (or FDBugs#47996 to be more accurate) and as the comments there indicate is already supported by pkgconf. At the time it was considered to first introduce a way to control/check the version of the pc-file syntax. While I agree this would have been a good idea to be implemented first back then, the situation now is different since the field is already supported for years by pkgconf and in use by several affected libraries since they simply have no other option to correctly link on Windows. Thus I think adding it as is now does much good but no (longer any additional) harm.
To give some perspective on the existing usage: just from the libraries which happen to be installed on my local machine libarchive, twolame, FriBidi and xmlsec are affected and already use
Cflags.private. Considerig that ""only"" libraries exposing variables (functions don't need the attribute) are affected this seems like a lot, though it is ofc in no way representative.
As currently there simply is no way with standard pc-files to solve this, I think a way should definitely be added to pkg-config. And since
Cflags.private is adequate for the challenge of mutating public headers based on linkage-mode and has already somewhat established itself (to the limits of how established a non-standard pc-file extension can be), adopting it in pkg-config seems like the obvious solution
I kept the implementation simple, matching the existing implementation of
Note that since building from git is currently broken with newer automake/autoconf I had to either first apply my other merge request dropping the interal glib copy, or alternatively update the internal glib copy to the latest release, but not specify
--with-internal-glib as that is then broken instead (see other MR) in order to build this.
Finally a small question: I noticed that unlike all other fields the existing
Cflags field can also be spelled
CFlags (with a capital
F); I mirrored that behaviour for
CFlags.private, but I wonder if you instead might prefer to keep this exception local to plain