Revert "Revert "partially fix #2149, partially support more efficient struct return (disabled). unfortunately this breaks ComplexPair{Int} (ComplexPair{Float64} seems OK)""

This reverts commit 4fa936436a1ebb44b4e73023e557d3f686f8dacc.
mostly fix #2149, and add tests for ccall structs. now only
ComplexPair{Int32} and similar small, integer structs are broken for
ccall pass-by-value (not a new problem)