Silverfrost Forums

Welcome to our forums

Static Libraries in Plato

13 Apr 2007 4:50 #1857

Dear friends of FTN95,

being a hobby programmer in Fortran (ephemeris calculation; planetary theory) and rather a novice on Fortran 95, I have in the last weeks with success converted some of my old programmes into such a mix of Fortran 77 and Fortran 95 that it could be accepted by the FTN95 compiler.

Of course, in those fields, there are many SUBROUTINEs and many FUNCTIONs common to many PROGRAMs. The solution is, of course, a library. Up to now, my Fortran 95 programmes are large source files which contain all of the procedures + a MODULE file with the PARAMETERs of the KINDs, the definitions of the dreived TYPEs (converted from the STRUCTUREs of Microsoft Fortran Power Station), the variables of the former COMMONs and the initializations from the former BLOCK DATA routines.

For the beginning, I have composed a Plato project for building a static library, the source files of this project being that MODULE file and a file containing a single SUBROUTINE. This works fine, the library has been created. (But a little bit tricky: at the first choice the are only four possibilities: Fortran or C++ applications or DLL's; nothing about LIB's. But after creating the project one can click through the menues: Project --> Set Target --> LIB!)

My problem now is: How can I use this library within a Plato project for creating an EXE file? I have tried all (?) possibilities, but none with success.

Project --> Properties --> Compiler Options --> Miscellaneous --> Extra Compiler Options: I have typed in the statement /LIBRARY '<filename>' with and without the quotation marks -- <filename> with the extension .LIB: the unresolved external reference remains unresolved -- <filename> without the extension .LIB: 'unable to open <filename>'.

Project --> Properties --> Linker Options --> Linker Options --> Extra Linker Options: -load:<filename>: 'Don't understand -load'; the keyword 'load' without hyphen or quite without this keyword, <filename> with or without quotation marks, with or without the extension .LIB: the same results as with the Extra Compiler Option.

LIBRARY '<filename>' directive in the source file: not possible without the quotation marks, but with and without the extension .LIB: the unresolved external reference remains unresolved. I have put the LIBRARY directive into the main programme after the declarations, before the first executable statement: is this the wrong place for the LIBRARY directive? -- By the way, I don't like very much FTN95's LIBRARY directive, because it is far from standard Fortran.

Can somebody help me with this probably not too hard problem? I don't like to begin with using FTN95 from the command line -- I would like to build my programmes within Plato, first of all because of its debug possibilities.

With thanks for your help and best wishes,

Wolfgang Höppner. 

14 Apr 2007 5:55 #1858

There are two approaches that should work, one you have mentioned.

  1. Use the Project References (in the Project Explorer window) to add a reference to the library. This will automatically use the full path of the library.

  2. Put the name of the library into Project --> Properties --> Linker Options --> Linker Options --> Extra Linker Options. You may need add the .lib extension but no prefix (-load etc). You may need to provide the full path or experiment by copying the library into a few places where the linker might expect to find it.

If you cannot get this to work, let me know and I will run one or two tests for you.

11 May 2007 3:05 #1913

[quote='PaulLaidler']There are two approaches that should work, one you have mentioned.

  1. Use the Project References (in the Project Explorer window) to add a reference to the library. This will automatically use the full path of the library.

  2. Put the name of the library into Project --> Properties --> Linker Options --> Linker Options --> Extra Linker Options. You may need add the .lib extension but no prefix (-load etc). You may need to provide the full path or experiment by copying the library into a few places where the linker might expect to find it.

If you cannot get this to work, let me know and I will run one or two tests for you.[/code]

Dear Mr Laidler,

Thank you very much for your advice. The first method works fine: to put the name of the library under 'References'.

Exactly this is stated on the Help page titled 'A simple Fortran project', but unfortunately, it has not been repeated on the pages dealing with creating and using libraries.

But now, in building my library, I have encountered another problem, for which I'll start another subject: 'Within Plato3, is the number of source files limited?'

Yours sincerely,

Wolfgang Höppner

11 May 2007 3:06 #1914

Dear Mr Laidler,

Thank you very much for your advice. The first method works fine: to put the name of the library under 'References'.

Exactly this is stated on the Help page titled 'A simple Fortran project', but unfortunately, it has not been repeated on the pages dealing with creating and using libraries.

But now, in building my library, I have encountered another problem, for which I'll start another subject: 'Within Plato3, is the number of source files limited?'

Yours sincerely,

Wolfgang Höppner.

Please login to reply.