The read functions have a lsm303dlhc_3d_data_t* argument which is a struct with 3 int16_t members. Thus we should cast res->val instead of just res.