H2MEX gateway generator. H2MEX - H2Mex is a program that gernerates automatically an interface file (MEX file) from a header file (the .h file). The Header file format is a pure C format, It’s extended with some modifiers that allows to H2MEX to understand the exact task of a function. The generated source (MEX file source) could be compiled without any modification to create a DLL which is callable from Matlab.