# HG changeset patch
# User Sam Lantinga <slouken@libsdl.org>
# Date 1343000017 25200
# Node ID 2ebb0d016f277f7f643d8a66ed0e1099e10d1fba
# Parent  56cad6484b04f83c8d42428c755a046678506436
Fixed normal linking with libmikmod and linking with earlier versions of libmikmod.

diff -r 56cad6484b04 -r 2ebb0d016f27 dynamic_mod.c
--- a/dynamic_mod.c	Sun Jul 22 16:13:27 2012 -0700
+++ b/dynamic_mod.c	Sun Jul 22 16:33:37 2012 -0700
@@ -97,8 +97,8 @@
 			(void (*)(void*))
 			SDL_LoadFunction(mikmod.handle, "MikMod_free");
 		if ( mikmod.MikMod_free == NULL ) {
-			SDL_UnloadObject(mikmod.handle);
-			return -1;
+			/* libmikmod 3.1 and earlier doesn't have it */
+			mikmod.MikMod_free = free;
 		}
 		mikmod.Player_Active =
 			(BOOL (*)(void))
@@ -246,6 +246,11 @@
 		mikmod.MikMod_RegisterDriver = MikMod_RegisterDriver;
 		mikmod.MikMod_errno = &MikMod_errno;
 		mikmod.MikMod_strerror = MikMod_strerror;
+#if LIBMIKMOD_VERSION < ((3<<16)|(2<<8))
+		mikmod.MikMod_free = free;
+#else
+		mikmod.MikMod_free = MikMod_free;
+#endif
 		mikmod.Player_Active = Player_Active;
 		mikmod.Player_Free = Player_Free;
 		mikmod.Player_LoadGeneric = Player_LoadGeneric;