MSVC2013 alternative to thread_local

pull/2825/head
bzt 2019-12-13 09:04:40 +01:00
parent 6b2fe41a3b
commit f151a5d11d
1 changed files with 12 additions and 2 deletions

View File

@ -48,10 +48,20 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/IOStreamBuffer.h>
#include <assimp/ai_assert.h>
// workaround: the M3D SDK expects a C callback, but we want to use Assimp::IOSystem to implement that
#if (__cplusplus >= 201103L) || !defined(_MSC_VER) || (_MSC_VER >= 1900) // C++11 and MSVC 2015 onwards
# define threadlocal thread_local
#else
# if defined(_MSC_VER) && (_MSC_VER >= 1800) // there's an alternative for MSVC 2013
# define threadlocal __declspec(thread)
# else
# define threadlocal
# endif
#endif
extern "C" {
thread_local void *m3dimporter_pIOHandler;
// workaround: the M3D SDK expects a C callback, but we want to use Assimp::IOSystem to implement that
threadlocal void *m3dimporter_pIOHandler;
unsigned char *m3dimporter_readfile(char *fn, unsigned int *size) {
ai_assert(nullptr != fn);