fortran

Free / Open Source Windows Fortran Compiler Compatable with Visual Studio

I'm trying to link in some legacy Fortran code with a Visual Studio C++ project. I tried using the Windows build of gfortran to build my static library but Visual Studio complains about unresolved external symbols. I guessing this is because mixing mingw and visual studio compilers is a horrible, horrible idea. I've googled a bit an...

How to pass parameter from C# to FORTRAN with parameter of type CHARACTER*50?

I have the following FORTRAN: SUBROUTINE MYSUB(MYPARAM) !DEC$ ATTRIBUTES DLLEXPORT::SetPaths CHARACTER*50 MYPARAM WRITE(6, *) MYPARAM END SUBROUTINE Then I have the following in C# class Program { static void Main(string[] args) { StringBuilder sb = new StringBuilder(50); sb.Append(@"something"); ...

Does FORTRAN's LEN_TRIM behave differently with passed parameters?

I have the following FORTRAN SUBROUTINE SETPATHS(INPUT) !DEC$ ATTRIBUTES DLLEXPORT::SetPaths CHARACTER*20 INPUT CHARACTER*20 DIRECTORY DIRECTORY = 'ABCDEFG' WRITE(6, *) 'INPUT LEN_TRIM = ', LEN_TRIM(INPUT) WRITE(6, *) 'DIRECTORYLEN_TRIM = ', LEN_TRIM(DIRECTORY) END SUBROUTINE And I'm calling the function from C#, p...

DEXP or EXP for exponential function in fortran?

Hello, I have two very short questions: 1 - I just read that DEXP() is the archaic form of EXP(). Does it mean that it should not be used anymore? I always thought that DEXP() was the double precision equivalent to EXP(). 2 - What is the range of the exponential function? Is it compiler dependent? Thanks in advance for your help! B...

Abstract Data Types in Fortran 77 (Fortran-II)?

I'm attempting to work in Fotran 77, and I've found the need for a tree based data structure. Aside from implementing a tree with an array, is there any way to build a tree with pointer nodes to other nodes, as per a standard implementation in most languages? The documentation for this beast is scarce, and there doesn't appear to be any...

Logical Type and Select in Fortran

I have encountered the following statement in fortran: integer iparam(11), ipntr(14) logical select(maxncv) Double precision & ax(maxn), d(maxncv,3), resid(maxn), & v(ldv,maxncv), workd(3*maxn), & workev(3*maxncv), & workl(3*maxncv*maxnc...

How to write a regular expression to match a string literal where the escape is a doubling of the quote character?

I am writing a parser using ply that needs to identify FORTRAN string literals. These are quoted with single quotes with the escape character being doubled single quotes. i.e. 'I don''t understand what you mean' is a valid escaped FORTRAN string. Ply takes input in regular expression. My attempt so far does not work and I don't unders...

GCC Produced Dlls Not Compatible with Intel Visual Fortran?

I used gcc to compile a few fortran source files into *.lib and *.dll on Windows platform, using the latest version of mingw . The gcc used is version 3. The result of the output is arpack_win32.dll, blas_win32.dll and lapack_win32.dll. I then want to compile sssimp.f against the arpack_win32.dll, blas_win32.dll and lapack_win32.dll usi...

Selecting k*k subarray from p*p*n array in Fortran

Hi, I have a p*p*n array in Fortran, and I want to extract k*k subarray from that bigger array. I tried like this, but not sure does it work: do i=1,p vp(i)=i end do help=y(1:p,t)*vp do t = 1, n A(1:k,1:k,t) = B(pack(help,help>0), pack(help,help>0), t) end do where y contains values 0 and 1, 1 meaning that row/column is wanted...

question about fortran continue statement in a for loop

hi, I am analyzing a code in fortran and have a simple question. I want to know what the "continue" statement at 100 and 200 in the code below does. Does it increment the i and j counters? If so, wouldn't if( .not. flg ) then condition contain the flg value that is the "last value" of flg in the loop j = i+1 to N? do 100 i = 1...

Why am I having problems passing argument to or from a FORTRAN DLL from VB.NET

I have a DLL written in fortran that I know works because I am getting it from a working software package that we use daily. I am trying to call it from anything but am having problems i believe with passing the correctly formatted arguments in and out of it, so i decided to try and access it from a VB program. I chose VB because I hav...

Passing arrays through fortran dll from vb.net app turning to single element arrays. Should i pass only the first element?

I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element. And that element is 0. I read on the internet somewhere that when doing this kind of thing it is a good...

CMake tutorial.

Can anyone provide link(s) to good CMake tutorial except very expensive and hard-to-get official one? Especially interesting in using CMake for Fortran projects but will be grateful for any good tutorial. Update. What I already found is CMake articles in Kitware Public Wiki. Fortran example is absolutely useless. =( Also while waiting...

Getting weird crashes in mixed fortran/C program

I am trying to replace some graphics code in a set of fortran programs (not my own code). I got one of the simpler ones ('psvdraw') to work just fine, replacing the fortran postscript-generating code with C calls that call the Cairo library (graphic_output.c). I have been able to successfully work out the cross-language calls without t...

[fortran 2003] how to write wrapper for 'allocate'

I am trying to write a wrapper for 'allocate' function, i.e. function which receives an array and dimensions, allocates memory and returns allocated array. The most important thing is that the function must work with arrays of different rank. But I have to explicitly state rank of array in function interface, and in this case code only c...

MPI Fortran Code Problem

I'm trying to run this MPI Fortran code. There are several problems: 1) when I run this code I expect the program to write 'Enter the number of intervals: (0 quits) ' to screen then ask me n. Instead it asks me n first!!! why? 2) if I don't comment out the line 'goto 10', the program keeps asking me n for ever and does not show me anyt...

(For what) Are Fortran, Cobol and Co. used today?

I'm a relatively young programmer and so I don't really know much about languages like Fortran or Cobol that have their origins in the beginning of modern informatics. I'm a bit confused because it seems like there are many people out there saying that these two languages are still very alive and being used all over the world whereas ot...

using dll in matlab

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. ...

Comparison of performance between Scala etc. and C/C++/Fortran?

Hi all, I wonder if there is any reliable comparison of performance between "modern" multithreading-specialized languages like e.g. scala and "classic" "lower-level" languages like C, C++, Fortran using parallel libs like MPI, Posix or even Open-MP. Any links and suggestions welcome. ...

ALLOCATABLE arrays or POINTER arrays?

Hello, I am writing a new code in Fortran and hesitating between using allocatable arrays or pointer arrays. I read somewhere that allocatable arrays have significant advantages over pointer arrays: 1) More efficient because they are always contiguous in memory 2) No memory leaks are possible Can someone confirm this? Which one wou...