I have 2 matrix structs means equal data but have different form like these:
// Matrix type 1.
typedef float Scalar;
typedef struct { Scalar e[4]; } Vector;
Well, you could just declare CATransform3DMakeScale like this:
Matrix CATransform3DMakeScale (CGFloat sx, CGFloat sy, CGFloat sz);
C doesn't type-check to make sure your deceleration matches the original library. If the memory layout is the same, it will work. However, it's bad coding practice and you should include a lengthy comment justifying your actions. ;-)
Otherwise, there's no way around it: you have to use pointers or copy the data. This would work:
CATransform3D m3d = CATransform3DMakeScale ( 1, 2, 3 );
Matrix m;
memcpy(&m, &m3d, sizeof m);
As you've discovered, you can't cast the structure directly. You also can't do this:
Matrix m = *(Matrix*) &CATransform3DMakeScale ( 1, 2, 3 );
because C only allows you to use the & operator on an l-value.