# (xunload appname \[flag\])
[GstarCAD 2011](../../../Index.md) → [Developer Reference](../../%28Developer%20Reference%29.md) → [AutoLISP Reference](../%28AutoLISP%20Reference%29.md) → [LISP Functions](%28LISP%20Functions%29.md)
<!-- help-structure:notice -->
> **Source status:** This source topic has 1 recorded inherited issue(s). [Source issue details](../../../Source%20Issues.md).
<!-- /help-structure:notice -->
<a id="314"></a>
## (xunload appname \[flag\])
---
Unload that SDS application.
---
This function unloads any [SDS](../../../Source%20Issues.md#issue-634ebdc55e2f29e1) application that is currently loaded. GstarCAD® tells the application to clean up any allocated memory and end itself, then unloads the application and unregisters its commands.
The optional *flag* argument is only used when an error occurs during loading. The **xunload** function returns the value of this *flag* upon failure; when *flag* is missing, an error message is displayed instead.
If the application you are attempting to xunload is not currently loaded, you see a message to that effect and the request will be ignored.
### Examples
| Code | Returns |
| --- | --- |
| (**xunload** "goodapp") | Unloads the application "goodapp". |
| (**xunload** "badapp") | Error unloading application: Could not find badapp.dll. |
| (**xunload** "badapp" "Uh-oh!") | Error loading application: Could not find badapp.dll. "Uh-oh!" |
| (**xunload** "badapp") | Unloads the application "goodapp". Error loading application: Could not find badapp.dll |
| (**xunload** "notloaded") | Error loading application: Could not find notloaded.dll Application "notloaded" not loaded error: XUNLOAD failed |
| (**xunload** "notloaded") | \*Cancel\* "notloaded" |
**Tell me about...**
[(ads)](%28ads%29.md)
[(load filename \[flag\])](%28load%20filename%20-flag-%29.md)
[(xload appname \[flag\])](IDR_LISP_B313.md)
[LISP Compatibility](../LISP%20Compatibility.md)
[Programming Overview of LISP (LISt Processing) Language](../Programming%20Overview%20of%20LISP%20%28LISt%20Processing%29%20Language.md)
<a id="holding"></a>
## Other versions with matching text
[GstarCAD 2012](../../../../2012/Developer%20Reference/AutoLISP%20Reference/LISP%20Functions/%28xunload%20appname%20-flag-%29.md)