New Reply

Creating FORTRAN Libraries

 
Share Thread
May17-12, 01:29 PM   #1
 

Creating FORTRAN Libraries


First time poster... I am trying to create fortran libraries for a test code I am writing. I had some success in doing so with a few examples from (specifically the kronrod src files):

john burkardt website (sorry I can't post URLs)

I would like to create a library from a file "electron_interactions.f95" that contains functions which are called by the main source. This is not an issue as long as I remove the global variables that are used throughout "electron_interactions.f95." This is what the commands look like in terminal:

g95 -c -g electron_interactions.f95
ar qc libelectron_interactions.a electron_interactions.o
mv libelectron_interactions.a /Users/David/lib/

g95 -c -g test.f95
g95 test.o -L$HOME/lib/ -ltest
mv a.out test

Where test.f95 is some main program calling the functions contained in the library.

Is it possible to create a library from a module that stores global variables, so I don't have to remove them to build the executable test?

Currently, I have src files with "use global" everywhere I want to access these variables. I wind up needing a nasty makefile.
PhysOrg.com science news on PhysOrg.com

>> New language discovery reveals linguistic insights
>> US official: Solar plane to help ground energy use (Update)
>> Four microphones, computer algorithm enough to produce 3-D model of simple, convex room
New Reply

Tags
fortran, library, linking

Similar discussions for: Creating FORTRAN Libraries
Thread Forum Replies
Fortran Builder 5.2 and Nag libraries Programming & Comp Sci 0
Fortran 90 creating an array of unknown size Programming & Comp Sci 3
Fortran: creating array containing characters Programming & Comp Sci 1
Accessing Fortran Modules within a Fortran library from Fortran Programming & Comp Sci 0
SGI libraries Programming & Comp Sci 0