views:

606

answers:

2

Hello everyone. i have a problem to using a dll fortran in matlab. i couldn't use a dll ,that is built by fortran, in matlab. i use "loadlibrary" instruction in matlab but the error is related to header files. what is header files?? please give me more information to load a dll fortran in matlab and call it.

+1  A: 

Without seeing your header file and the command line you're using in MATLAB, it's hard to help you too much here. You might reference the documentation in MATLAB which request that you pass two arguments to loadlibrary, the second being the header file with function signatures. I am guessing you are not providing this second argument.

Conspicuous Compiler
+2  A: 

Rather than try to use a dll file directly I suggest you re-build it using Matlab's MEX functionality. Yes, a mex file is a dll and you can build dlls outside Matlab and use them successfully, it's a lot easier, for a beginner such as I guess you to be, to use MEX. One way in which it is easier is that, if you build a mex file, the system won't ask you for a header file which is, as you know, a rather foreign concept to a Fortran programmer. Another way in which MEX will make your life easier is that you can then call the function exposed by the dll directly from Matlab's command line, without loadlibrary.

Study the Matlab documentation on MEX files, pay particular attention to how to integrate Fortran this way.

High Performance Mark