Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 23)
+++ test/Makefile.am	(revision 29)
@@ -6,5 +6,5 @@
 endif
 
-noinst_PROGRAMS=ctest basictest basicctest multigettest multisettest
+noinst_PROGRAMS=ctest basictest basicctest multigettest multigetctest multisettest
 
 ctest_SOURCES=ctest.c
@@ -22,3 +22,8 @@
 multigettest_SOURCES=multigettest.cc
 
+multigetctest_SOURCES=multigetctest.c
+if TARGET_API_WIN32
+multigetctest_LDFLAGS=-lstdc++
+endif
+
 multisettest_SOURCES=multisettest.cc
Index: test/basicctest.c
===================================================================
--- test/basicctest.c	(revision 25)
+++ test/basicctest.c	(revision 29)
@@ -340,4 +340,5 @@
 
     retval = 1;
+
 cleanup:
     if (connectionID>=0) xplra_disconnect(connectionID);
Index: test/multigetctest.c
===================================================================
--- test/multigetctest.c	(revision 29)
+++ test/multigetctest.c	(revision 29)
@@ -0,0 +1,338 @@
+// 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 <hu/varadiistvan/xplra/xplra.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef __windows__
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+//------------------------------------------------------------------------------
+
+int main(int argc, char* argv[])
+{
+    int retval = 0;
+    const char* errorString;
+
+    int i;
+
+    int connectionID = -1;
+    int getterID = -1;
+
+    size_t tailnumID = INVALID_DATAREF_ID;
+    size_t daysID = INVALID_DATAREF_ID;
+    size_t zuluSecID = INVALID_DATAREF_ID;
+    size_t pausedID = INVALID_DATAREF_ID;
+    size_t latitudeID = INVALID_DATAREF_ID;
+    size_t longitudeID = INVALID_DATAREF_ID;
+    size_t replayID = INVALID_DATAREF_ID;
+    size_t overspeedID = INVALID_DATAREF_ID;
+    size_t stalledID = INVALID_DATAREF_ID;
+    size_t onTheGroundID = INVALID_DATAREF_ID;
+    size_t emptyWeightID = INVALID_DATAREF_ID;
+    size_t payloadWeightID = INVALID_DATAREF_ID;
+    size_t grossWeightID = INVALID_DATAREF_ID;
+    size_t headingID = INVALID_DATAREF_ID;
+    size_t pitchID = INVALID_DATAREF_ID;
+    size_t bankID = INVALID_DATAREF_ID;
+    size_t iasID = INVALID_DATAREF_ID;
+    size_t machID = INVALID_DATAREF_ID;
+    size_t groundSpeedID = INVALID_DATAREF_ID;
+    size_t vsID = INVALID_DATAREF_ID;
+    size_t radioAltitudeID = INVALID_DATAREF_ID;
+    size_t altitudeID = INVALID_DATAREF_ID;
+    size_t gLoadID = INVALID_DATAREF_ID;
+    size_t flapsControlID = INVALID_DATAREF_ID;
+    size_t flapsLeftID = INVALID_DATAREF_ID;
+    size_t flapsRightID = INVALID_DATAREF_ID;
+    size_t navLightsID = INVALID_DATAREF_ID;
+    size_t beaconLightsID = INVALID_DATAREF_ID;
+    size_t strobeLightsID = INVALID_DATAREF_ID;
+    size_t landingLightsID = INVALID_DATAREF_ID;
+    size_t pitotID = INVALID_DATAREF_ID;
+    size_t parkingID = INVALID_DATAREF_ID;
+    size_t gearControlID = INVALID_DATAREF_ID;
+    size_t noseGearID = INVALID_DATAREF_ID;
+    size_t altimeterID = INVALID_DATAREF_ID;
+    size_t qnhID = INVALID_DATAREF_ID;
+    size_t navTypesID = INVALID_DATAREF_ID;
+    size_t busVoltsID = INVALID_DATAREF_ID;
+
+    const char* tailnum = 0;
+    const int32_t* days = 0;
+    const float* zuluSec = 0;
+    const int32_t* paused = 0;
+    const double* latitude = 0;
+    const double* longitude = 0;
+    const int32_t* replay = 0;
+    const int32_t* overspeed = 0;
+    const int32_t* stalled = 0;
+    const int32_t* onTheGround = 0;
+    const float* emptyWeight = 0;
+    const float* payloadWeight = 0;
+    const float* grossWeight = 0;
+    const float* heading = 0;
+    const float* pitch = 0;
+    const float* bank = 0;
+    const float* ias = 0;
+    const float* mach = 0;
+    const float* groundSpeed = 0;
+    const float* vs = 0;
+    const float* radioAltitude = 0;
+    const float* altitude = 0;
+    const float* gLoad = 0;
+    const float* flapsControl = 0;
+    const float* flapsLeft = 0;
+    const float* flapsRight = 0;
+    const int32_t* navLights = 0;
+    const int32_t* beaconLights = 0;
+    const int32_t* strobeLights = 0;
+    const int32_t* landingLights = 0;
+    const int32_t* pitot = 0;
+    const float* parking = 0;
+    const int32_t* gearControl = 0;
+    const float* noseGear = 0;
+    const float* altimeter = 0;
+    const float* qnh = 0;
+    const int32_t* navTypes = 0;
+    const float* busVolts = 0;
+
+    int dontregister = 0;
+
+    for(i = 1; i<argc; ++i) {
+        if (strcmp(argv[i], "dontregister")==0) {
+            dontregister = 1;
+        }
+    }
+
+    printf("Connecting to X-Plane...\n");
+    connectionID = xplra_connect();
+    if (connectionID>=0) {
+        printf("Connected to X-Plane.\n\n");
+    } else {
+        printf("Connection failed.\n\n");
+        goto cleanup;
+    }
+
+    getterID = xplra_multi_create_getter(connectionID);
+    if (getterID<0) goto error;
+
+    tailnumID = xplra_multi_add_byte_array(getterID, "sim/aircraft/view/acf_tailnum", 40, 0);
+    daysID = xplra_multi_add_int(getterID, "sim/time/local_date_days");
+    zuluSecID = xplra_multi_add_float(getterID, "sim/time/zulu_time_sec");
+    pausedID = xplra_multi_add_int(getterID, "sim/time/paused");
+    latitudeID = xplra_multi_add_double(getterID, "sim/flightmodel/position/latitude");
+    longitudeID = xplra_multi_add_double(getterID, "sim/flightmodel/position/longitude");
+    replayID = xplra_multi_add_int(getterID, "sim/operation/prefs/replay_mode");
+    overspeedID = xplra_multi_add_int(getterID, "sim/flightmodel/failures/over_vne");
+    stalledID = xplra_multi_add_int(getterID, "sim/flightmodel/failures/stallwarning");
+    onTheGroundID = xplra_multi_add_int(getterID, "sim/flightmodel/failures/onground_any");
+    emptyWeightID = xplra_multi_add_float(getterID, "sim/aircraft/weight/acf_m_empty");
+    payloadWeightID = xplra_multi_add_float(getterID, "sim/flightmodel/weight/m_fixed");
+    grossWeightID = xplra_multi_add_float(getterID, "sim/flightmodel/weight/m_total");
+    headingID = xplra_multi_add_float(getterID, "sim/flightmodel/position/psi");
+    pitchID = xplra_multi_add_float(getterID, "sim/flightmodel/position/theta");
+    bankID = xplra_multi_add_float(getterID, "sim/flightmodel/position/phi");
+    iasID = xplra_multi_add_float(getterID, "sim/flightmodel/position/indicated_airspeed2");
+    machID = xplra_multi_add_float(getterID, "sim/flightmodel/misc/machno");
+    groundSpeedID = xplra_multi_add_float(getterID, "sim/flightmodel/position/groundspeed");
+    vsID = xplra_multi_add_float(getterID, "sim/flightmodel/position/vh_ind_fpm2");
+    radioAltitudeID = xplra_multi_add_float(getterID, "sim/flightmodel/position/y_agl");
+    altitudeID = xplra_multi_add_float(getterID, "sim/flightmodel/position/elevation");
+    gLoadID = xplra_multi_add_float(getterID, "sim/flightmodel/forces/g_nrml");
+    flapsControlID = xplra_multi_add_float(getterID, "sim/flightmodel/controls/flaprqst");
+    flapsLeftID = xplra_multi_add_float(getterID, "sim/flightmodel/controls/flaprat");
+    flapsRightID = xplra_multi_add_float(getterID, "sim/flightmodel/controls/flap2rat");
+    navLightsID = xplra_multi_add_int(getterID, "sim/cockpit/electrical/nav_lights_on");
+    beaconLightsID = xplra_multi_add_int(getterID, "sim/cockpit/electrical/beacon_lights_on");
+    strobeLightsID = xplra_multi_add_int(getterID, "sim/cockpit/electrical/strobe_lights_on");
+    landingLightsID = xplra_multi_add_int(getterID, "sim/cockpit/electrical/landing_lights_on");
+    pitotID = xplra_multi_add_int(getterID, "sim/cockpit/switches/pitot_heat_on");
+    parkingID = xplra_multi_add_float(getterID, "sim/flightmodel/controls/parkbrake");
+    gearControlID = xplra_multi_add_int(getterID, "sim/cockpit2/controls/gear_handle_down");
+    noseGearID = xplra_multi_add_float_array(getterID, "sim/flightmodel2/gear/deploy_ratio", 1, 0);
+    altimeterID = xplra_multi_add_float(getterID, "sim/cockpit/misc/barometer_setting");
+    qnhID = xplra_multi_add_float(getterID, "sim/flightmodel/misc/Qstatic");
+    navTypesID = xplra_multi_add_int_array(getterID, "sim/cockpit/radios/nav_type", 6, 0);
+    busVoltsID = xplra_multi_add_float_array(getterID, "sim/cockpit2/electrical/bus_volts", 4, 0);
+
+    if (dontregister) {
+        xplra_multi_finalize(getterID);
+    } else {
+        printf("Registering getter...\n");
+        if (xplra_multi_register(getterID)<0) goto error;
+        printf("Registered getter.\n\n");
+    }
+
+    tailnum = xplra_multi_get_string_ptr(getterID, tailnumID, 0);
+    days = xplra_multi_get_int_ptr(getterID, daysID);
+    zuluSec = xplra_multi_get_float_ptr(getterID, zuluSecID);
+    paused = xplra_multi_get_int_ptr(getterID, pausedID);
+    latitude = xplra_multi_get_double_ptr(getterID, latitudeID);
+    longitude = xplra_multi_get_double_ptr(getterID, longitudeID);
+    // frozen
+    // slew
+    replay = xplra_multi_get_int_ptr(getterID, replayID);
+    overspeed = xplra_multi_get_int_ptr(getterID, overspeedID);
+    stalled = xplra_multi_get_int_ptr(getterID, stalledID);
+    onTheGround = xplra_multi_get_int_ptr(getterID, onTheGroundID);
+    emptyWeight = xplra_multi_get_float_ptr(getterID, emptyWeightID);
+    payloadWeight = xplra_multi_get_float_ptr(getterID, payloadWeightID);
+    grossWeight = xplra_multi_get_float_ptr(getterID, grossWeightID);
+    heading = xplra_multi_get_float_ptr(getterID, headingID);
+    pitch = xplra_multi_get_float_ptr(getterID, pitchID);
+    bank = xplra_multi_get_float_ptr(getterID, bankID);
+    ias = xplra_multi_get_float_ptr(getterID, iasID);
+    mach = xplra_multi_get_float_ptr(getterID, machID);
+    groundSpeed = xplra_multi_get_float_ptr(getterID, groundSpeedID);
+    vs = xplra_multi_get_float_ptr(getterID, vsID);
+    radioAltitude = xplra_multi_get_float_ptr(getterID, radioAltitudeID);
+    altitude = xplra_multi_get_float_ptr(getterID, altitudeID);
+    gLoad = xplra_multi_get_float_ptr(getterID, gLoadID);
+    flapsControl = xplra_multi_get_float_ptr(getterID, flapsControlID);
+    flapsLeft = xplra_multi_get_float_ptr(getterID, flapsLeftID);
+    flapsRight = xplra_multi_get_float_ptr(getterID, flapsRightID);
+    navLights = xplra_multi_get_int_ptr(getterID, navLightsID);
+    beaconLights = xplra_multi_get_int_ptr(getterID, beaconLightsID);
+    strobeLights = xplra_multi_get_int_ptr(getterID, strobeLightsID);
+    landingLights = xplra_multi_get_int_ptr(getterID, landingLightsID);
+    pitot = xplra_multi_get_int_ptr(getterID, pitotID);
+    parking = xplra_multi_get_float_ptr(getterID, parkingID);
+    gearControl = xplra_multi_get_int_ptr(getterID, gearControlID);
+    noseGear = xplra_multi_get_float_array_ptr(getterID, noseGearID, 0);
+    altimeter = xplra_multi_get_float_ptr(getterID, altimeterID);
+    qnh = xplra_multi_get_float_ptr(getterID, qnhID);
+    navTypes = xplra_multi_get_int_array_ptr(getterID, navTypesID, 0);
+    busVolts = xplra_multi_get_float_array_ptr(getterID, busVoltsID, 0);
+
+    while(1) {
+        if (xplra_multi_execute(getterID)<0) return -1;
+        printf("tail number: '%s', days: %d, zuluSec: %f\n",
+               tailnum, *days, *zuluSec);
+        printf("paused=%d, replay=%d, overspeed=%d, stalled=%d, onTheGround=%d\n",
+               *paused, *replay, *overspeed, *stalled, *onTheGround);
+        printf("emptyWeight=%f, payloadWeight=%f, grossWeight=%f\n",
+               *emptyWeight, *payloadWeight, *grossWeight);
+        printf("latitude=%f, longitude=%f, radioAltitude=%f, altitude=%f, gLoad=%f\n",
+               *latitude, *longitude, (*radioAltitude)/.3048, (*altitude)/.3048, *gLoad);
+        printf("heading=%f, pitch=%f, bank=%f, ias=%f, mach=%f, groundSpeed=%f, vs=%f\n",
+               *heading, *pitch, *bank, *ias, *mach, *groundSpeed, *vs);
+        printf("flapsControl=%f, flapsLeft=%f, flapsRight=%f\n",
+               *flapsControl, *flapsLeft, *flapsRight);
+        printf("Lights: NAV: %d, beacon: %d, strobe: %d, landing: %d\n",
+               *navLights, *beaconLights, *strobeLights, *landingLights);
+        printf("pitot: %d, parking: %f, gearControl: %d, noseGear: %f\n",
+               *pitot, *parking, *gearControl, *noseGear);
+        printf("altimeter: %f, qnh: %f\n",
+               *altimeter, *qnh);
+        printf("NAV types: %d %d %d %d %d %d\n",
+               navTypes[0], navTypes[1], navTypes[2],
+               navTypes[3], navTypes[4], navTypes[5]);
+        printf("bus voltages: %f %f %f %f\n",
+               busVolts[0], busVolts[1], busVolts[2], busVolts[3]);
+        printf("\n");
+#ifdef __windows__
+        Sleep(1000);
+#else
+        usleep(1000*1000);
+#endif
+    }
+
+    goto cleanup;
+
+error:
+    errorString = xplra_get_last_error_string(connectionID);
+    if (errorString==0) {
+        printf("\nUnknown error occured!\n");
+    } else {
+        printf("\nError: %s\n", errorString);
+    }
+
+    retval = 1;
+
+cleanup:
+    if (connectionID>=0) xplra_disconnect(connectionID);
+    return retval;
+
+    // try {
+
+
+    //     while(true) {
+    //         getter.execute();
+    //         printf("tail number: '%s', days: %d, zuluSec: %f\n",
+    //                getter.getString(tailnumID).c_str(), days, zuluSec);
+    //         printf("paused=%d, replay=%d, overspeed=%d, stalled=%d, onTheGround=%d\n",
+    //                paused, replay, overspeed, stalled, onTheGround);
+    //         printf("emptyWeight=%f, payloadWeight=%f, grossWeight=%f\n",
+    //                emptyWeight, payloadWeight, grossWeight);
+    //         printf("latitude=%f, longitude=%f, radioAltitude=%f, altitude=%f, gLoad=%f\n",
+    //                latitude, longitude, radioAltitude/.3048, altitude/.3048, gLoad);
+    //         printf("heading=%f, pitch=%f, bank=%f, ias=%f, mach=%f, groundSpeed=%f, vs=%f\n",
+    //                heading, pitch,bank, ias, mach, groundSpeed, vs);
+    //         printf("flapsControl=%f, flapsLeft=%f, flapsRight=%f\n",
+    //                flapsControl, flapsLeft, flapsRight);
+    //         printf("Lights: NAV: %d, beacon: %d, strobe: %d, landing: %d\n",
+    //                navLights, beaconLights, strobeLights, landingLights);
+    //         printf("pitot: %d, parking: %f, gearControl: %d, noseGear: %f\n",
+    //                pitot, parking, gearControl, noseGear);
+    //         printf("altimeter: %f, qnh: %f\n",
+    //                altimeter, qnh);
+    //         printf("NAV types: %d %d %d %d %d %d\n",
+    //                navTypes[0], navTypes[1], navTypes[2],
+    //                navTypes[3], navTypes[4], navTypes[5]);
+    //         printf("bus voltages: %f %f %f %f\n",
+    //                busVolts[0], busVolts[1], busVolts[2], busVolts[3]);
+    //         printf("\n");
+    //         Thread::sleep(1000);
+    //     }
+
+    //     //xplane.destroyMultiBuffer(getter);
+
+    //     return 0;
+    // } catch(Exception& exception) {
+    //     printf("\n>>>>>>>>>>>>>>>>> Exception caugth: %s\n", exception.what());
+
+    //     return 1;
+    // }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: test/multigettest.cc
===================================================================
--- test/multigettest.cc	(revision 26)
+++ test/multigettest.cc	(revision 29)
@@ -146,5 +146,5 @@
         const int32_t& pitot = getter.getIntRef(pitotID);
         const float& parking = getter.getFloatRef(parkingID);
-        const int32_t& gearControl = getter.getInt(gearControlID);
+        const int32_t& gearControl = getter.getIntRef(gearControlID);
         const float& noseGear = getter.getFloatArray(noseGearID)[0];
         const float& altimeter = getter.getFloatRef(altimeterID);
