From e08188aeda8c419b741313ef34ef0e49ac6eb6a4 Mon Sep 17 00:00:00 2001
From: Matthew Flatt <mflatt@racket-lang.org>
Date: Mon, 28 Dec 2015 07:37:04 -0600
Subject: [PATCH] add source for "racket-playsound.exe"

---
 racket/src/native-libs/README.txt  |  3 +++
 racket/src/native-libs/playsound.c | 10 ++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 racket/src/native-libs/playsound.c

diff --git a/racket/src/native-libs/README.txt b/racket/src/native-libs/README.txt
index 8d174f7e68..5ce71afdc7 100644
--- a/racket/src/native-libs/README.txt
+++ b/racket/src/native-libs/README.txt
@@ -155,6 +155,9 @@ More details for Windows:
    uses `-static-libgcc' and `-static-libstdc++' to statically link
    those libraries. Use "depends.exe" to check DLL dependencies.
 
+ * The extra "playsound.c" program is meant to be compiled to
+   "racket-playsound.exe" for the "gui" library.
+
 More details for Mac OS X:
 
  * 32-bit binaries are built for 10.5 and up. 64-bit binaries are
diff --git a/racket/src/native-libs/playsound.c b/racket/src/native-libs/playsound.c
new file mode 100644
index 0000000000..329fb3b50f
--- /dev/null
+++ b/racket/src/native-libs/playsound.c
@@ -0,0 +1,10 @@
+#include <Windows.h>
+
+/* Doesn't attempt to parse the command line in the usual way.
+   Instead, the whole command-line is used as a path of a
+   sound file to play. */
+
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR ignored, int nCmdShow)
+{
+  return PlaySoundW(GetCommandLineW(), NULL, SND_SYNC);
+}