Skip to content

glapi: Never use dllimport/dllexport for TLS vars on Windows

Jesse Natalie requested to merge jenatali/mesa:glapi-tls-fix-again into main

When building without shared glapi, the _GLAPI_NO_EXPORTS define is only set while building the static libglapi itself, meaning that other static libs that are going to link against it will end up setting _GLAPI_EXPORT to __declspec(dllimport).

This is honestly probably a bigger problem that should be fixed, but it doesn't cause any real impact except for the TLS variables, where it causes a compile break when building the other code:

##[error]mesa\src\mapi\glapi\glapi.h(86,85): Error C2492: '_glapi_tls_Dispatch': data with thread storage duration may not have dll interface

So... just never mark the TLS variables as import or export on Windows. They never will be - either they're accessed directly within a single DLL, or they're accessed via exported/imported functions.

/cc @lygstate

Merge request reports