forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linking codes

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Fonya



Joined: 08 Jun 2009
Posts: 3

PostPosted: Mon Jun 08, 2009 7:01 pm    Post subject: Linking codes Reply with quote

Hi all,
I'm new to fortran and have a problem linking the main program to sub routines. Program calls many subroutines that in turn call up other subroutines. I get a runtime error for the very first one "Error 29, Call to a missing routine ..." when I try to execute. First I paste the errors and further below is the somewhat lengthy program!
Please help out!
Fonya




WARNING the following symbols are missing:
JULIAN_DAY C:\thinclouds\retrieval\src\lgotemp@.obj
(C:\THINCLOUDS\RETRIEVAL\


Last edited by Fonya on Wed Jun 10, 2009 2:50 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Tue Jun 09, 2009 7:39 am    Post subject: Reply with quote

you need to use slink to link all the .obj files, or have one .f file.
for example

if you have the files
mainasc.f
sub1.f
sub2.f

you need the commands and text input
ftn95 main asc.f
ftn95 sub1.f
ftn95 sub2.f

slink
lo mainasc.obj
lo sub1.obj
lo sub2.obj
file mainasc.exe

Alternatively you could have the source file "all.f" consisting only of
include 'mainasc.f'
include 'sub1.f'
include 'sub2.f'

then compile and link or compile and go with

ftn95 all.f /link
ftn95 all.f /lgo

You should read help on slink, as the slink commands can be put into a text file of commands.

My solution is for operating in a dos (cmd.exe) box. If you want to use PLATO then someone else can help.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Tue Jun 09, 2009 9:31 am    Post subject: Reply with quote

The alternative is to put your files into a project using an IDE like Plato or Visual Studio then the IDE will sort out the linking for you.
Back to top
View user's profile Send private message AIM Address
Fonya



Joined: 08 Jun 2009
Posts: 3

PostPosted: Thu Jun 18, 2009 11:08 pm    Post subject: Reply with quote

Great! I use slink to link all the .obj files. I can now create my .exe even though it won't run because of NETCDF. Thank you!

Does the compiler have NETCDF libraries? How do establish the link to NETCDF lib?

Fonya
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7926
Location: Salford, UK

PostPosted: Fri Jun 19, 2009 8:41 am    Post subject: Reply with quote

I have had a quick look at the Unidata website and it looks like you have the following basic options.

1. Use a existing library written in Fortran.
2. Use a existing library written in C/C++.
3. Download the Fortran source code and compile using FTN95.
4. Download the C/C++ source code and compile using SCC.

The main thing to be aware of is the most third party libraries use the STDCALL protocol but by default FTN95 and SCC do not. This means that options 3 and 4 may prove easier in the long run.

Have a look in the FTN95 help file searcing for STDCALL. Also note the compiler switch /IMPORT_LIB.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group