Added the ugly ATEXIT_HACK from GLUT 3.7, making freeglut binary compatible with...
[freeglut] / src / freeglut_init.c
index 01dabc7..9b4eb09 100644 (file)
@@ -25,6 +25,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#define FREEGLUT_BUILDING_LIB
 #include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
@@ -853,6 +854,16 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
     }
 }
 
+#ifdef _WIN32
+void (__cdecl *__glutExitFunc)( int retval ) = NULL;
+
+void FGAPIENTRY __glutInitWithExit( int *argcp, char **argv, void (__cdecl *exitfunc)(int) )
+{
+  __glutExitFunc = exitfunc;
+  glutInit(argcp, argv);
+}
+#endif
+
 /*
  * Undoes all the "glutInit" stuff
  */