This version of GMP is upwardly binary compatible with all 4.x and 3.x versions, and upwardly compatible at the source level with all 2.x versions, with the following exceptions.
mpn_gcd had its source arguments swapped as of GMP 3.0, for consistency
with other mpn functions.
mpf_get_prec counted precision slightly differently in GMP 3.0 and
3.0.1, but in 3.1 reverted to the 2.x style.
There are a number of compatibility issues between GMP 1 and GMP 2 that of course also apply when porting applications from GMP 1 to GMP 4. Please see the GMP 2 manual for details.
The Berkeley MP compatibility library (see BSD Compatible Functions) is source and binary compatible with the standard libmp.