How to compile single fortran objects using f2c translator?

I have the following problem: I want to simulate some content management system. Since this is quite complicated, I used a computer to get some (complex) equations that can only be exported to fortran77 code. On my development computer, this is not a problem (linux machine).

No, I want to do this on hardware, and here I have to use Windows. Unfortunately, Matlab does not support gfortran on windows. Therefore, I cannot compile fortran files in this field.

My idea now was to translate to C, since the C compiler is available in Matlab upon victory. Any other (best) options?

I have several SUBROUTINES in the following order.

SUBROUTINE sys_rhs (x, v, dx, param) REAL*8 x(6) C code is coming here RETURN END SUBROUTINE 

Good practice and does the sys_rhs__ function sys_rhs__ in an interface function written in C? The problem is that I cannot test it, since I do not have massive access to the Windows machine. Therefore, it should work if I try, and I do not need to experiment a lot.

Also, what do I need in the windows? Where can I get them?

Thanks Christian

+6
source share
4 answers

The answer was quite simple: I had some syntax errors in the fortran code. gfortran does not perform such strict syntax checks and therefore correctly interprets fortran code. After deleting the typos, I transcoded using f2c.

thanks

0
source

Intel sells a pretty good fortran compiler ( http://software.intel.com/en-us/articles/fortran-compilers/ ), which they used for free distribution for testing ... ;-)

PS No, I have nothing to do with this company!

0
source

You might want to check out the gnumex project, which allows you to compile MEX files using the GNU GCC compiler (using MinGW or Cygwin), with the option of using g77 to compile Fortran programs.

0
source

there is a better solution for all this

use your linux machine or your windows machine to implement the function in c / c ++ and then generate the dll file.

In Matlab, you can load the DLL and make a function call inside it.

Here is a simple tutorial that shows how to call dll with matlab.

http://www.mathworks.com/matlabcentral/fileexchange/15065-example-of-loading-c-dll-and-performance-comparison

-1
source

Source: https://habr.com/ru/post/898089/


All Articles