-
Calling C from matlab----some experience
2007-01-31
I am using the GNU glpk toolkit to solve a linear programming problem, but unfortunately the GLPK toolkit is written for C/C++, so I have to write a mex interface so that I can directly call the GLPK from matlab.
Some online resources for writing mex and compiling mex file :
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/
1 A trick to compile multiple mex file including some .lib:
matlab prompt> mex glpkmex.cpp glpk.lib
The mex file after compiking has the extension .mexw32 on matlab version that is higher than 7.3.
2 A trick to debuge mex file through MS studio .NET and matlab
see
http://www.mathworks.com/access/helpdesk/help/techdoc/
then click "External interfaces"-->"Creating C Language MEX-Files"-->"Debugging C Language MEX-Files"
3. We can also try to compile a mex file using MS. NET, see
http://www.mee.tcd.ie/~sigmedia/intranet/coding/HowtoMex.php
4 We can also use gcc to create a mex file, see







