ajaym,
Only need to call FreeHeapPtr() with the returned value from GetSetXYZState() functions, search reaper_plugin_functions.h for "xml/rpp".
Polling will work fine too of course, especially if it makes your port easier.
CSurf_TrackFromID(0, false) gets you a pointer to the master track where most GetSetMediaTrackInfo stuff works. GetNumTracks() doesn't include the master, so valid range for CSurf_TrackFromID(n, 0) is 0 <= n <= GetNumTracks().
Feel free to use my
reaper_plugin.h, it has fixes for the undefined symbols.