1 <HTML 2 ><HEAD 3 ><TITLE 4 >SDL_Quit</TITLE 5 ><META 6 NAME="GENERATOR" 7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8 "><LINK 9 REL="HOME" 10 TITLE="SDL Library Documentation" 11 HREF="index.html"><LINK 12 REL="UP" 13 TITLE="General" 14 HREF="general.html"><LINK 15 REL="PREVIOUS" 16 TITLE="SDL_QuitSubSystem" 17 HREF="sdlquitsubsystem.html"><LINK 18 REL="NEXT" 19 TITLE="SDL_WasInit" 20 HREF="sdlwasinit.html"></HEAD 21 ><BODY 22 CLASS="REFENTRY" 23 BGCOLOR="#FFF8DC" 24 TEXT="#000000" 25 LINK="#0000ee" 26 VLINK="#551a8b" 27 ALINK="#ff0000" 28 ><DIV 29 CLASS="NAVHEADER" 30 ><TABLE 31 SUMMARY="Header navigation table" 32 WIDTH="100%" 33 BORDER="0" 34 CELLPADDING="0" 35 CELLSPACING="0" 36 ><TR 37 ><TH 38 COLSPAN="3" 39 ALIGN="center" 40 >SDL Library Documentation</TH 41 ></TR 42 ><TR 43 ><TD 44 WIDTH="10%" 45 ALIGN="left" 46 VALIGN="bottom" 47 ><A 48 HREF="sdlquitsubsystem.html" 49 ACCESSKEY="P" 50 >Prev</A 51 ></TD 52 ><TD 53 WIDTH="80%" 54 ALIGN="center" 55 VALIGN="bottom" 56 ></TD 57 ><TD 58 WIDTH="10%" 59 ALIGN="right" 60 VALIGN="bottom" 61 ><A 62 HREF="sdlwasinit.html" 63 ACCESSKEY="N" 64 >Next</A 65 ></TD 66 ></TR 67 ></TABLE 68 ><HR 69 ALIGN="LEFT" 70 WIDTH="100%"></DIV 71 ><H1 72 ><A 73 NAME="SDLQUIT" 74 ></A 75 >SDL_Quit</H1 76 ><DIV 77 CLASS="REFNAMEDIV" 78 ><A 79 NAME="AEN585" 80 ></A 81 ><H2 82 >Name</H2 83 >SDL_Quit -- Shut down SDL</DIV 84 ><DIV 85 CLASS="REFSYNOPSISDIV" 86 ><A 87 NAME="AEN588" 88 ></A 89 ><H2 90 >Synopsis</H2 91 ><DIV 92 CLASS="FUNCSYNOPSIS" 93 ><A 94 NAME="AEN589" 95 ></A 96 ><P 97 ></P 98 ><PRE 99 CLASS="FUNCSYNOPSISINFO" 100 >#include "SDL.h"</PRE 101 ><P 102 ><CODE 103 ><CODE 104 CLASS="FUNCDEF" 105 >void <B 106 CLASS="FSFUNC" 107 >SDL_Quit</B 108 ></CODE 109 >(void);</CODE 110 ></P 111 ><P 112 ></P 113 ></DIV 114 ></DIV 115 ><DIV 116 CLASS="REFSECT1" 117 ><A 118 NAME="AEN595" 119 ></A 120 ><H2 121 >Description</H2 122 ><P 123 ><TT 124 CLASS="FUNCTION" 125 >SDL_Quit</TT 126 > shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit. For the sake of simplicity you can set <TT 127 CLASS="FUNCTION" 128 >SDL_Quit</TT 129 > as your <TT 130 CLASS="FUNCTION" 131 >atexit</TT 132 > call, like: 133 <PRE 134 CLASS="PROGRAMLISTING" 135 >SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); 136 atexit(SDL_Quit); 137 . 138 .</PRE 139 ></P 140 ><DIV 141 CLASS="NOTE" 142 ><BLOCKQUOTE 143 CLASS="NOTE" 144 ><P 145 ><B 146 >Note: </B 147 >While using <TT 148 CLASS="FUNCTION" 149 >atexit</TT 150 > maybe be fine for small programs, more advanced users should shut down SDL in their own cleanup code. Plus, using <TT 151 CLASS="FUNCTION" 152 >atexit</TT 153 > in a library is a sure way to crash dynamically loaded code</P 154 ></BLOCKQUOTE 155 ></DIV 156 ></DIV 157 ><DIV 158 CLASS="REFSECT1" 159 ><A 160 NAME="AEN606" 161 ></A 162 ><H2 163 >See Also</H2 164 ><P 165 ><A 166 HREF="sdlquitsubsystem.html" 167 ><TT 168 CLASS="FUNCTION" 169 >SDL_QuitSubsystem</TT 170 ></A 171 >, 172 <A 173 HREF="sdlinit.html" 174 ><TT 175 CLASS="FUNCTION" 176 >SDL_Init</TT 177 ></A 178 ></P 179 ></DIV 180 ><DIV 181 CLASS="NAVFOOTER" 182 ><HR 183 ALIGN="LEFT" 184 WIDTH="100%"><TABLE 185 SUMMARY="Footer navigation table" 186 WIDTH="100%" 187 BORDER="0" 188 CELLPADDING="0" 189 CELLSPACING="0" 190 ><TR 191 ><TD 192 WIDTH="33%" 193 ALIGN="left" 194 VALIGN="top" 195 ><A 196 HREF="sdlquitsubsystem.html" 197 ACCESSKEY="P" 198 >Prev</A 199 ></TD 200 ><TD 201 WIDTH="34%" 202 ALIGN="center" 203 VALIGN="top" 204 ><A 205 HREF="index.html" 206 ACCESSKEY="H" 207 >Home</A 208 ></TD 209 ><TD 210 WIDTH="33%" 211 ALIGN="right" 212 VALIGN="top" 213 ><A 214 HREF="sdlwasinit.html" 215 ACCESSKEY="N" 216 >Next</A 217 ></TD 218 ></TR 219 ><TR 220 ><TD 221 WIDTH="33%" 222 ALIGN="left" 223 VALIGN="top" 224 >SDL_QuitSubSystem</TD 225 ><TD 226 WIDTH="34%" 227 ALIGN="center" 228 VALIGN="top" 229 ><A 230 HREF="general.html" 231 ACCESSKEY="U" 232 >Up</A 233 ></TD 234 ><TD 235 WIDTH="33%" 236 ALIGN="right" 237 VALIGN="top" 238 >SDL_WasInit</TD 239 ></TR 240 ></TABLE 241 ></DIV 242 ></BODY 243 ></HTML 244 >