Added Mex example, fixed mex builder dependency handling