From 5d52ad15485207684410487476f5d965a8d23674 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 26 Aug 2012 18:42:15 +0200 Subject: [PATCH] Replaced GLFWGLOBAL and _init_c_ with extern. --- src/init.c | 18 +++++++++++++++++- src/internal.h | 23 +++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/init.c b/src/init.c index e1d5dfc9..9303c255 100644 --- a/src/init.c +++ b/src/init.c @@ -28,13 +28,29 @@ // //======================================================================== -#define _init_c_ #include "internal.h" #include #include +////////////////////////////////////////////////////////////////////////// +////// GLFW internal API ////// +////////////////////////////////////////////////////////////////////////// + +//======================================================================== +// Platform independent global state shared between compilation units +//======================================================================== + +// Flag indicating whether GLFW has been initialized +GLboolean _glfwInitialized = GL_FALSE; + +// All global data protected by _glfwInitialized +// This data should only be touched after a call to glfwInit that has +// not been followed by a call to glfwTerminate +_GLFWlibrary _glfwLibrary; + + ////////////////////////////////////////////////////////////////////////// ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// diff --git a/src/internal.h b/src/internal.h index 89ac48b2..d286c5cb 100644 --- a/src/internal.h +++ b/src/internal.h @@ -31,17 +31,6 @@ #ifndef _internal_h_ #define _internal_h_ -//======================================================================== -// GLFWGLOBAL is a macro that places all global variables in the init.c -// module (all other modules reference global variables as 'extern') -//======================================================================== - -#if defined(_init_c_) - #define GLFWGLOBAL -#else - #define GLFWGLOBAL extern -#endif - //======================================================================== // Input handling definitions @@ -245,17 +234,15 @@ struct _GLFWlibrary //======================================================================== -// System independent global variables (GLFW internals) +// Platform independent global state shared between compilation units +// These are exported from init.c //======================================================================== // Flag indicating if GLFW has been initialized -#if defined(_init_c_) -GLboolean _glfwInitialized = GL_FALSE; -#else -GLFWGLOBAL GLboolean _glfwInitialized; -#endif +extern GLboolean _glfwInitialized; -GLFWGLOBAL _GLFWlibrary _glfwLibrary; +// All global data protected by _glfwInitialized +extern _GLFWlibrary _glfwLibrary; //========================================================================