Silverfrost Forums

Welcome to our forums

Linking codes

8 Jun 2009 6:01 (Edited: 10 Jun 2009 1:50) #4677

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\

9 Jun 2009 6:39 #4680

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.

9 Jun 2009 8:31 #4681

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.

18 Jun 2009 10:08 #4715

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

19 Jun 2009 7:41 #4716

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.

Please login to reply.