this appears to be working - need to test on linux with gcc