Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Beginner Questions: Calling Subroutines and A Development Tool

Status
Not open for further replies.

androidmelt

Programmer
Mar 3, 2010
6
GB
Hi Everyone.
I'm new here so I'll introduce myself.

I am a new Fortran user and have some experience in programming from the past.
I wanted your help on the following 2 questions:

QUESTION 1)
======================
I am using an ancient Fortran compiler to write the code. Is there a Object oriented style program where it is much easier to write the fortran code - one that allows you to build windows and buttons etc (OOP).

Example: Delphi is the object oriented development program for the PASCAL language. It allows you to make windows and objects etc.

I am looking for something similiar for FORTRAN if it exists?



QUESTION 2)
========================
This question is about calling subroutines from a module.

Suppose I have a program which calls a subroutine from a module. This subroutine calls another subroutine from another module. Is that possible?

example: main program calls subroutine "subB" from the module modB. subB then calls subroutine "subA" from module "modA". Is this possible (as shown below)?

My program keeps giving errors saying that the modules have no public objects declared in the module so nothing can be use associated.

I was instaed thinking of creating a seperate module modVariables with all the variables and then just telling the modules to use the variables from modVariables through the "USE modVariables" statement. Isn't this possible?


Module modA
...
Subroutine subA
End Module modA

Module modB
Uses modA
Implicit None

Subroutine subB
Call Subroutine subA
End Subroutine subB
End Module modB

Program Main
Uses
....
call Subroutine subB
End Program Main

 
1) There are surely commercial libraries for creating GUIs with Fortran: I thing Intel Visual Fortran is such product, although I never worked with it.

2) Maybe your question with modules could be answered by this example integration.f95:
There are 2 modules used in the program.
The module integration_methods contains methods for numerical quadrature and the module user_functions contains user defined functions to be integrated.
The main program uses both modules, so each integration method can call each user defined function.
 
Thanks mikrom, haven't had much luck with GUI creating software. They mostly talk about VB environments. Seems too complicated. Need something simpler.

As for problem 2, your explanation help me quite a lot :) I've got it working now .

Thanks once again ! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top