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 over multiple directories

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Sat Mar 01, 2008 12:51 am    Post subject: Linking over multiple directories Reply with quote

My question concerns linking with .obj files that reside in a different directory to the main program. I use NMAKE for all my development. I use a make file of the following form.

Code:
ThisDir = C:\K_f90\MyProg\V3_1.00
MyLib   = C:\K_f90\MyLib\V0_0.13

FTN   = FTN95 /ISO /IMPLICIT_NONE /NO_SCALAR_TO_ARRAY /RESTRICT_SYNTAX /CHECKMATE /BRIEF /ERRORLOG /MOD_PATH $(MyLib)

MYPROG.EXE  : MYPROG.OBJ MYSUBS.OBJ
                SLINK MYPROG.OBJ MYSUBS.OBJ $(MyLib)\SUBS1.OBJ $(MyLib)\SUBS2.OBJ

MYPROG.OBJ  : MYPROG.FOR ; $(FTN) MYPROG.FOR

MYSUBS.OBJ  : MYSUBS.FOR ; $(FTN) MYSUBS.FOR


While this works, it is very cumbersome as my actual project has many more files than shown in this simplified example. What I would really like to be able to do would be to have one file (MYOBJS.LLS, say) with the following contents.

Code:
MYPROG MYSUBS SUBS1 SUBS2

Then the corresponding section of the make file would be,

Code:
MYPROG.EXE  : MYPROG.OBJ MYSUBS.OBJ
                SLINK @MYOBJS.LLS


Of course, this doesn’t work because SLINK does not know where the .obj files are located. What commands/options do I need in my make file to enable the myobjs.lls file to be used to specify the list of .obj files that are to be linked?

Keith
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Mar 01, 2008 9:32 am    Post subject: Reply with quote

SLINK does not appear the have an option to look for .obj files in a specified folder.

If you were to link your .obj files into a static library (.lib) then the path of the .lib could be included in a LIB environment variable (which is similar to the PATH environment variable).
Back to top
View user's profile Send private message AIM Address
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Sat Mar 01, 2008 9:56 am    Post subject: Reply with quote

That’s a shame. I’m using several different Fortran compilers and wanted a solution that allowed me to switch rapidly between different compilers (basically just use different make file). I have managed to link successfully in the manner described with the other compilers. Is there a way of doing this using the /LINK and /MOD_PATH options with FTN95?

Keith
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Mar 01, 2008 2:38 pm    Post subject: Reply with quote

If you use /LINK with /MOD_PATH then FTN95 will pass on the relevant paths to SLINK. (I have plans to get Plato to do something similar for multiple files but I have not done this yet).

FTN95 also allows a wild-card compile in the form

FTN95 *.f90

but I have not tried this with /LINK and /MOD_PATH. It would be worth a try.
Back to top
View user's profile Send private message AIM Address
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Sun Mar 02, 2008 12:11 am    Post subject: Reply with quote

Let me get this straight. I can give SLINK an explicit list of .obj file names to link but I can’t give it a search path. I can give FTN95 a search path, which it will pass on to SLINK, but I cannot give it an explicit list of file names. This is surely a major oversight in the design of FTN95/SLINK.

The only way of specifying more than one file name to FTN95 is via a wild-card (please correct me if I’m wrong). I find that very restrictive compared to the other compilers I’m using. To my mind I should be able to specify any combination of explicit files to compile and/or link.

Keith
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sun Mar 02, 2008 12:45 am    Post subject: Reply with quote

Keith,

Why not work in a cmd.exe "dos box" environment and use batch files for the compile and link. This can be done without any modification to the search path.
You can compile the source in any directory and then use an input file for slink. Use a batch file for the compiles and includes an input file for slink. ( I've never got into the habit of using make) I typically use the command "slink load.txt" in a batch file, where load.txt lists the (tree)names of all files to link. An example from the last few commands in one of my load.txt files include:-

lo srsp_ed.obj
lo ceasect.obj
lo ..\train_info\train_load.obj
le \clearwin\graphlib.f95\graphlib.lib
le \clearwin\clearlib.dev\crtlib.lib
le \clearwin\plotlib.f95\plotlib.lib
le \clearwin\saplib.mem\saplib.lib
le \clearwin\iolib.f95\iolib.lib
map saplot.map
file saplot.exe

I hope I havn't missed what you have been trying to do but the functionality is certainly there for multiple directories and drives.

regards john
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Mar 02, 2008 9:21 am    Post subject: Reply with quote

Keith

Your summary is accurate and your comments have been duly noted.

I can add an option to SLINK fairly easily and I will add this to the list of things to do.

The situation with FTN95 may be more complex but I will investigate to see if there is an obvious reason why the option to compile a specified list of files has been excluded.
Back to top
View user's profile Send private message AIM Address
Keith Waters



Joined: 07 Aug 2007
Posts: 29
Location: London or Somerset, UK

PostPosted: Sun Mar 02, 2008 11:19 am    Post subject: Reply with quote

Thanks Paul.

John - the problem is not that I cannot get FTN95/SLINK to compile and link my project: I have already done that successfully using the make file shown in my initial post.

Perhaps I didn’t explain fully my situation. I have a multi-file/multi-directory project that I need to build using a range of different compilers. On top of that I have several such projects. My aim was that for each project I would have all the file names that needed to be linked listed in one file (MYOBJS.LLS, say). Then, whenever a change occurred resulting in addition or removal of a file, I could make the appropriate change in the single MYOBJS.LLS. This I have managed to do for the other compilers I am using.

Keith
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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