fortran

FORTRAN function returning an array causes a segfault (calling from C++)

Basically, here's my problem. I'm calling someone else's FORTRAN functions from my C++ code, and it's giving me headaches. Some code: function c_error_message() character(len = 255) :: c_error_message errmsg(1:9) = 'ERROR MSG' return end That's the FORTRAN function. My first question is: Is there anything in there that would cause a s...

What's the macro to distinguish ifort from other fortran compilers?

I'm working with Fortran code that has to work with various Fortran compilers (and is interacting with both C++ and Java code). Currently, we have it working with gfortran and g95, but I'm researching what it would take to get it working with ifort, and the first problem I'm having is figuring out how to determine in the source code whet...

Function pointer arrays in Fortran

I can create function pointers in Fortran 90, with code like real, external :: f and then use f as an argument to another function/subroutine. But what if I want an array of function pointers? In C I would just do double (*f[])(int); to create an array of functions returning double and taking an integer argument. I tried the most o...

How to debug command line file with symbolic data

I have a compiled .exe file (compiled with gfortran and -g option) that crashes. I can attach the WinDBG program to it using the WinDBG -I command. Funny enough it generates a stack overflow: (38f0.2830): Stack overflow - code c00000fd (!!! second chance !!!) However, the output says that there is no debugging information in my progr...

Has anyone worked with EnergyPlus simulation software?

http://apps1.eere.energy.gov/buildings/energyplus/ I am researching about this software at the moment and I am wondering : How many people actually know how to use this software? Please identify yourself if you do. How many companies are using this to run energy saving simulations at the moment? Please list any you know. Is it integra...

Dependency Walker Not Showing All the Depended Dll

I have a fortran dll, and I want to know the assemblies that it depends on for redistribution purpose. One thing I found out is that the dependency walker doesn't show all of the dependencies, i.e, there are some dlls that my assembly is dependent on, but dependency walker doesn't show it out. An example would be a dll that makes use...

FORTRAN: determine variable type

hello, GOOGLE has yet to find an answer for me, so here goes: In FORTRAN, is there a way to determine the TYPE of a variable? E.G., pass the variable type as an argument in a function, to then be able to call type-specific code with that fuction; eliminating the need to have seperate similar functions for each data type. thanks. ...

undefined references

Hello, I'm trying to compile some fortran code and I'm running into some confusing linking errors. I have some code that I compile and place into a static library: >gfortran -c -I../../inc -o bdout.o bdout.F >ar rv libgeo.a bdout.o I then try to compile against that library with some simple test code and get the following: >gfortran...

Are local variables in Fortran 77 static or stack dynamic?

For my programming languages class one hw problem asks: Are local variables in FORTRAN static or stack dynamic? Are local variables that are INITIALIZED to a default value static or stack dynamic? Show me some code with an explanation to back up your answer. Hint: The easiest way to check this is to have your program test the histor...

Attempting my first fortran 95 program, to solve quadratic eqn. Getting weird errors.

So, I'm attempting my first program in Fortran, trying to solve quadratic eqn. I have double and triple checked my code and don't see anything wrong. I keep getting "Invalid character in name at (1)" and "Unclassifiable statement at (1)" at various locations. Any help would be greatly appreciated... ! This program solves quadratic equat...

Problem: Vectorizing Code with Intel Visual FORTRAN for X64

I'm compiling my fortran90 code using Intel Visual FORTRAN on Windows Server 2003 Enterprise X64 Edition. When I compile the code for 32 bit structure and using automatic and manual vectorizing options. The code will be compiled, vectorized. And when I run it on 8 core system the compiled code uses 70% of CPU that shows me that vectorizi...

Fortran recursion segmentation faults

Hey all - I have to design and implement a Fortran routine to determine the size of clusters on a square lattice, and it seemed extremely convenient to code the subroutine recursively. However, whenever my lattice size grows beyond a certain value (around 200/side), the subroutine consistently segfaults. Here's my cluster-detection rout...

How to Install two library CGNS for Fortran under WIndows XP

Hello, I have to install two libraries CGNS to use it in Fortan, but I don't understand how, the basic instructions are: To compile under MS Windows: configure.bat [options] then gmake if using GNU make, or nmake if using nmake. NOTE: This assumes that the cl compiler is in your path, and that the INCLUDE and LIB environment var...

Receive Event Notification Broad-casted from Fortran in Managed Code

I have a fortran (unmanaged code) dll as the calculation engine, and a C# form as the GUI. Now, the calculation in fortran is long, so in order not to bore the users, I decided to use Asynch command to create a progress bar. The fortran dll would be responsible for putting messages in the progress bar as the calculation proceeds. Any i...

C or Ada for engineering computations?

Hi,as an engineer I currently use C to write programs dealing with numerical methods. I like C as it's very fast. I don't want to move to C++ and I have been reading a bit about Ada which has some very good sides. I believe that much of the software in big industries have been or more correctly were written in Ada. I would like to know...

How To: Referencing LAPACK library from FORTRAN 95 in Cygwin

I have a FORTRAN 95 program that needs to make some calls to the LAPACK library. I recently found out that Cygwin because it can install LAPACK as an extra option. Well, LAPACK exists in the /lib/lapack/ directory as "cyglapack.dll". Having only a very informal training in Fortran programming, I have no idea how to reference a .dll libr...

Importing data from file to array

I have 2 dimensional table in file, which look like this: 11, 12, 13, 14, 15 21, 22, 23, 24, 25 I want it to be imported in 2 dimensional array. I wrote this code: INTEGER :: SMALL(10) DO I = 1, 3 READ(UNIT=10, FMT='(5I4)') SMALL WRITE(UNIT=*, FMT='(6X,5I4)') SMALL ENDDO But it imports eve...

C/C++ opaque pointer library

hello Is there library/header already written to manage C++ objects from C using opaque pointers/handles? I can write one myself, but I would rather use already made solution, especially if it has fortran bindings. my specific requirements are: wrapper generation facility (my thought is to use boost preprocessor) handling objects th...

Automatic translation from fortran 90 to f77

Hello Is there an converter from fortran 90 downto fortran 77 ? I have a fortran77 only compiler and want to run NAS Parallel Benchmark (NPB for short) on it. But NPB uses some features of F90, like do enddo, smth else. All features are rather simple. Is there A way to translate NPB to F77 strict language? Tags: fortran parallel conv...

matlab's fortran's format equivalents

What would be matlab's equivalent of write(1,'("Speed, resistance, power",3f8.2)')(a(i),i=1,3) I've tried a = [10. 20. 200.] fprintf(unit1,'a = 3%8.1e',a) but I'm still having trouble with it (the whole matlab output formatting thing). Edit for Kenny: for the values of a as given above, it would give (in a new row): Speed, res...