This heavily commented Fortran program serves as a simple example on how a MATLAB .m file can be called from Fortran. Suitable if this is your first time trying this.
The basic mechanism is to pack the C-compiled .m into a .dll and link to it from Fortran. Argument and result xfer mechanism is explained so that program can be easily expanded.
8"unresolved external symbol" errors dispite of the adding .lib files
I have downloaded the program to call a matlab dll from Fortran CVF 6.6B.
As it did not work with MatLab v 7.2 and I saw a message from Frank Tap, I would be very grateful if anyone might tell me how to deal with this issue.
Thank you very much
After some minor modifications it worked fine for R2006a and CVF 6.6b. Previously I tried to do it myself and stopped because it took me too much time to find it out.
Have you tried "looking into" libmx.lib with the DOS command "dumpbin/exports libmx.lib" (you can also use the "Windows Dependency Walker" available from http://www.dependencywalker.com/)? See comments in my code. You should see all those routines supplied by MATLAB with those two tools. If they are there I don't understand why they are not linked in, if they are not there you should find a library with them in your MATLAB installation.
Did as you said. "unresolved external symbol" errors are reduced to 5 from 8 errors. It recognize the mxCopyPtrToReal8 and a few others, but error still occurs for mxGetData,mxGetNumberOfElements,mxCreateNumericMatrix,mxClassIDFromClassName,and mxDestroyArray. Any insight?
Copy libmx.lib from your \extern\lib\win32\digital\df60\ Matlab area to "source" in your VF development area and then include libmx.lib into your project via: Project->addToProject->Files->select ".lib" from pulldown menu->select libmx.lib from "source". Same procedure for all other .lib's you may need.
I keep having "unresolved external symbol" errors regarding to the mx* functions. I don't know how to solve this problem. I'm using the Windows 2000 and Visual Fortran 6.6.