Index: src/xplra/ListenThread.cc
===================================================================
--- src/xplra/ListenThread.cc	(revision 0)
+++ src/xplra/ListenThread.cc	(revision 1)
@@ -31,5 +31,5 @@
 #include "ListenThread.h"
 
-#include <XPLMUtilities.h>
+#include <xplcommon/Util.h>
 
 //------------------------------------------------------------------------------
@@ -37,9 +37,11 @@
 using xplra::ListenThread;
 
+using xplcommon::Util;
+
 //------------------------------------------------------------------------------
 
 void ListenThread::run()
 {
-    XPLMDebugString("xplra::ListenThread::run: started\n");
+    Util::debug("xplra::ListenThread::run: started\n");
 
     while(!quitEvent.check() && !quitEvent.failed()) {
@@ -47,5 +49,5 @@
     }
 
-    XPLMDebugString("xplra::ListenThread::run: quitting\n");
+    Util::debug("xplra::ListenThread::run: quitting\n");
 }
 
Index: src/xplra/Makefile.am
===================================================================
--- src/xplra/Makefile.am	(revision 0)
+++ src/xplra/Makefile.am	(revision 1)
@@ -5,5 +5,10 @@
 if TARGET_API_WIN32
 AM_CPPFLAGS=-DIBM
-AM_LDFLAGS=@XPSDK_LDFLAGS@ -lXPLM -no-undefined
+AM_LDFLAGS=@XPSDK_LDFLAGS@ -no-undefined
+if TARGET_API_WIN64
+AM_LDFLAGS+=-lXPLM_64
+else
+AM_LDFLAGS+=-lXPLM
+endif
 endif
 
Index: src/xplra/plugin.cc
===================================================================
--- src/xplra/plugin.cc	(revision 0)
+++ src/xplra/plugin.cc	(revision 1)
@@ -1,3 +1,35 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
 #include "ListenThread.h"
+
+#include <xplcommon/Util.h>
 
 #include <XPLMDefs.h>
@@ -13,27 +45,19 @@
 using xplra::ListenThread;
 
+using xplcommon::Util;
+
 //------------------------------------------------------------------------------
 
+/**
+ * The thread to use to listen for incoming connections.
+ */
 static ListenThread* listenThread = 0;
 
 //------------------------------------------------------------------------------
 
-static void debug(const char* format, ...)
-{
-    va_list ap;
-    va_start(ap, format);
-
-    char buf[256];
-    vsnprintf(buf, sizeof(buf), format, ap);
-
-    va_end(ap);
-
-    XPLMDebugString(buf);
-}
-
 PLUGIN_API int XPluginStart(char* outName, char* outSignature,
                             char* outDescription)
 {
-    debug("hu.varadiistvan.xplra called\n");
+    Util::debug("hu.varadiistvan.xplra called\n");
 
     strcpy(outName, "X-Plane Remote Access");
@@ -44,16 +68,9 @@
 }
 
-// float callback(float elapsedSinceLastCall, float elapsedTimeSinceLastFlightLoop,
-//               int counter, void* refcon)
-// {
-//     debug("hu.varadiistvan.proba.callback called: elapsedSinceLastCall=%f, elapsedTimeSinceLastFlightLoop=%f, counter=%d, refcon=%p\n",
-//           elapsedSinceLastCall, elapsedTimeSinceLastFlightLoop,
-//           counter, refcon);
-//     return 5.0;
-// }
+//------------------------------------------------------------------------------
 
 PLUGIN_API void XPluginEnable(void)
 {
-    debug("hu.varadiistvan.proba.XPluginEnable called\n");
+    Util::debug("hu.varadiistvan.xplra.XPluginEnable called\n");
     // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
     listenThread = new ListenThread();
@@ -61,14 +78,18 @@
 }
 
+//------------------------------------------------------------------------------
+
 PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, long inMessage,
                                       void* inParam)
 {
-    debug("hu.varadiistvan.proba.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
+    Util::debug("hu.varadiistvan.xplra.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
           inFrom, inMessage, inParam);
 }
 
+//------------------------------------------------------------------------------
+
 PLUGIN_API void XPluginDisable(void)
 {
-    debug("hu.varadiistvan.proba.XPluginDisable called\n");
+    Util::debug("hu.varadiistvan.xplra.XPluginDisable called\n");
     // XPLMUnregisterFlightLoopCallback(&callback, 0);
     if (listenThread!=0) {
@@ -78,6 +99,16 @@
 }
 
+//------------------------------------------------------------------------------
+
 PLUGIN_API void XPluginStop(void)
 {
-    debug("hu.varadiistvan.proba.XPluginStop called\n");
+    Util::debug("hu.varadiistvan.xplra.XPluginStop called\n");
 }
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
