View previous topic :: View next topic |
Author |
Message |
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Sun Oct 13, 2019 4:41 pm Post subject: Compiling modules via a relative path |
|
|
When compiling a basic programme with a module from another directory, the module is included (and found) by the compiler but the functions within are not accessible and the compiler complains.
When copying the module source to the same directory and referencing it direct, all works as expected.
For example the following fails;
Code: | ftn95 ..\CommonModules\Whatever.f95
ftn95 MainApp.f95 /link /debug
|
With 'WARNING the following symbols are missing:' etc.
Copying Whatever.f95 to the current directory and using;
Code: | ftn95 Whatever.f95
ftn95 MainApp.f95 /link /debug
|
Works fine and the executable can be run.
What dumbness am I doing?
FYI: This is for a common module that is used amongst several projects, I really don't want to copy and paste. I can use a symlink if this cannot be worked around, but they have their own problems.
Thanks in advance,
Ryan |
|
Back to top |
|
|
Robert
Joined: 29 Nov 2006 Posts: 445 Location: Manchester
|
Posted: Sun Oct 13, 2019 5:52 pm Post subject: |
|
|
I am guessing here that Whatever.obj is in ..\CommonModules but the .mod file is placed in the current directory. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Sun Oct 13, 2019 7:04 pm Post subject: |
|
|
Correct. The module can be found in the local directory, but is somehow corrupted.
I've not got out a hex editor yet to see the difference, they both are 1kb so look similar (I've not got the byte count handy). |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Sun Oct 13, 2019 7:07 pm Post subject: |
|
|
When you compile a module then this normally yields two types of file, .mod and .obj files (or their 64 bit equivalents) in the same folder.
FTN95 needs to "see" the .mod file when it encounters the corresponding USE statement. The linker needs to scan the .obj file when linking.
You can use /mod_path to access .mod files in a different folder. You can also tell the linker where to find the .obj files but in this case it needs help.
One approach is to do no copying and to use /mod_path when compiling and a link script or LIBRARY directive for linking. |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Oct 18, 2019 12:05 am Post subject: |
|
|
'Tw'ud be good to add a set of examples of these compile/link instructions to the relevant section(s) in the manuals. _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
|
|