[Pcsclite-cvs-commit] CVS libmusclecard/src

CVS User rousseau ludovic.rousseau@free.fr
Thu, 21 Apr 2005 09:35:03 +0000


Update of /cvsroot/pcsclite/libmusclecard/src
In directory haydn:/tmp/cvs-serv7871

Modified Files:
	musclecard.c 
Log Message:
release the context when the library is unloaded.

Thanks to Karsten Ohme for the patch


--- /cvsroot/pcsclite/libmusclecard/src/musclecard.c	2005/04/21 09:26:43	1.48
+++ /cvsroot/pcsclite/libmusclecard/src/musclecard.c	2005/04/21 09:35:02	1.49
@@ -10,7 +10,7 @@
  * You may not remove this header from this file without 
  * prior permission from the author.
  *
- * $Id: musclecard.c,v 1.48 2005/04/21 09:26:43 rousseau Exp $
+ * $Id: musclecard.c,v 1.49 2005/04/21 09:35:02 rousseau Exp $
  */
 
 #include "config.h"
@@ -63,6 +63,21 @@
 #endif
 }
 
+/* Library constructor and deconstructor function for UNIX */
+#ifndef WIN32
+void __attribute__ ((constructor)) musclecard_init(void)
+{
+}
+	
+void __attribute__ ((destructor)) musclecard_fini(void)
+{
+	if (localHContext != 0)
+		SCardReleaseContext(localHContext);
+
+	localHContext = 0;
+}
+#endif
+
 /**************** MSC Connection Functions **************************/
 
 MSC_RV MSCListTokens(MSCULong32 listScope, MSCLPTokenInfo tokenArray,