From 543ad0c11294051a51775d346bf660e2d87ba36e Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sun, 11 Feb 2018 11:29:32 -0800 Subject: [PATCH] stb_image_write: tweak handling of STB_IMAGE_WRITE_STATIC --- stb_image_write.h | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/stb_image_write.h b/stb_image_write.h index 39befed..c05e958 100644 --- a/stb_image_write.h +++ b/stb_image_write.h @@ -148,25 +148,23 @@ LICENSE #ifndef INCLUDE_STB_IMAGE_WRITE_H #define INCLUDE_STB_IMAGE_WRITE_H -#ifndef STB_IMAGE_WRITE_STATIC -#ifdef __cplusplus -extern "C" { -#endif -#endif - +// if STB_IMAGE_WRITE_STATIC causes problems, try defining STBIWDEF to 'inline' or 'static inline' #ifndef STBIWDEF #ifdef STB_IMAGE_WRITE_STATIC -#define STBIWDEF static +#define STBIWDEF static #else -#define STBIWDEF extern +#ifdef __cplusplus +#define STBIWDEF extern "C" +#else +#define STBIWDEF extern +#endif #endif #endif -#ifndef STB_IMAGE_WRITE_STATIC -// C++ forbids static forward declarations -STBIWDEF int stbi_write_tga_with_rle; -STBIWDEF int stbi_write_png_compression_level; -STBIWDEF int stbi_write_force_png_filter; +#ifndef STB_IMAGE_WRITE_STATIC // C++ forbids static forward declarations +extern int stbi_write_tga_with_rle; +extern int stbi_write_png_compression_level; +extern int stbi_write_force_png_filter; #endif #ifndef STBI_WRITE_NO_STDIO @@ -187,12 +185,6 @@ STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, STBIWDEF void stbi_flip_vertically_on_write(int flip_boolean); -#ifndef STB_IMAGE_WRITE_STATIC -#ifdef __cplusplus -} -#endif -#endif - #endif//INCLUDE_STB_IMAGE_WRITE_H #ifdef STB_IMAGE_WRITE_IMPLEMENTATION