View previous topic :: View next topic |
Author |
Message |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Wed Feb 22, 2017 10:21 am Post subject: Converting "include" to "use" |
|
|
In my software I am using
Code: | include <clearwin.ins>
include <exceptn.ins>
include <opengl.ins>
include <win32api.ins>
include <windows.ins>
| Can I change all of them and use modules instead? Which modules? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Feb 22, 2017 11:35 am Post subject: |
|
|
For Silverfrost compilers...
Code: | INCLUDE <clearwin.ins> USE clrwin
INCLUDE <win32api.ins> USE mswin32
INCLUDE <win32prm.ins> USE msw32prm
INCLUDE <windows.ins> USE mswin
INCLUDE <opengl.ins> USE opengl |
The code for mswin is:
Code: | module mswin
use msw32prm
use mswin32
use clrwin
end module mswin |
So mswin is the same as clrwin + mswin32 + msw32prm.
There is no standard module for exceptn.ins. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed Feb 22, 2017 1:08 pm Post subject: |
|
|
Paul,
Can you clarify something please? The <> means "search the default include directory" and is non-standard. As written above, presumably the default include directory is searched. How then do we differentiate between the current and default directories? Does USE use the same non-standard syntax?
Assuming that the type of the USE file is .MOD, this is not readable by a text editor, so in that case is the .INS file never totally redundant (assuming you need to know anything about its contents).
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Wed Feb 22, 2017 4:52 pm Post subject: |
|
|
Eddie
FTN95 uses a list of INCLUDE folders starting with the Silverfrost INCLUDE folder but also containing any folders added by the user via /INCLUDE or an environment variable.
When using <file>, this list is scanned first before scanning the local folder.
When using "file", the local folder is scanned first before scanning the list.
So it only makes a material difference if the name of an include file (that is found from the list) is duplicated locally.
USE statements contain the name of the module and not the name of a file. So you can have more than one module in a file and there is no quotation marks nor <> in a USE statement.
Mod files have the extension .mod (for 32 bits) and .mod64 (for 64 bits). For FTN95 the mod files are encoded but the corresponding .ins file will be maintained should you need to know the code for the module.
The Silverfrost folder FTN95\source64\ contains some source files for using ClearWin+ with third party compilers. These use ISO_C_BINDING interfaces so the corresponding mod files require associated obj files at link time. This is not the case when using Silverfrost compilers because the interfaces do not require any associated object code. This may change when we implement ISO_C_BINDING in FTN95. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Thu Feb 23, 2017 10:11 am Post subject: |
|
|
Paul,
my new problem is now that I have a directory ..\Moduls for my own globally used moduls. It is parallel to all my projects.
I tried to add this direcctory to the standard mod_path environment variable, but the compiler does not except this.
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Feb 23, 2017 11:38 am Post subject: |
|
|
Erwin
What does MOD_PATH look like?
Use a semi-colon separator and the full path.
Type SET on the command line to see it. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Feb 23, 2017 12:42 pm Post subject: |
|
|
OK, I slept on it, but I still don't understand what this implies:
Quote: | USE statements contain the name of the module and not the name of a file. So you can have more than one module in a file ...
|
OK if the module is coded into the same source code file, What if it isn't? Does it all get sorted out by SLINK? Where do you specify the name of the MOD file?
I think I'll stick to INS
Eddie |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Thu Feb 23, 2017 12:55 pm Post subject: |
|
|
Paul,
that's what I tried:
mod_path=C:\Program Files (x86)\Silverfrost\FTN95\include;..\Moduls
Code: | INTEGER FUNCTION f3dReadData ()
USE f3dViewData
USE GrafFiles
USE opengl
IMPLICIT NONE
INCLUDE <clearwin.ins>
:: |
I changed include opengl to USE ...
Result:
Compiling file: 3dReadData.f90
D:\Bgo_7.0\3dView\3dReadData.F90(6) : error 404 - Cannot find definition for MODULE OPENGL
Compilation failed. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Feb 23, 2017 1:20 pm Post subject: |
|
|
A .mod file is created for each module and FTN95 exports object code for any modules that are USEd.
So if test.f95 contains a module m1 and a main program then compiling will generate m1.mod and test.obj. Then linking generates test.exe.
Alternatively if test.f95 contains modules m1 and m2 and no main program then compiling generates m1.mod, m2.mod and test.obj. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Feb 23, 2017 2:25 pm Post subject: |
|
|
Hi Paul,
Thanks for the clarification. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Thu Feb 23, 2017 6:42 pm Post subject: |
|
|
Erwin
Try using the full path instead of ..\.
Try changing the order of the USE statements.
Try using INCLUDE <opengl.ins> instead of USE opengl.
Failing that, please send me a short working program that demonstrates the failure. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Fri Feb 24, 2017 10:28 am Post subject: |
|
|
Paul,
the problem is: There is no module file for opengl; neither .mod nor .mod64.
Can you please provide these files and let me know where to place them.
There is no problem to change the other files from "include" to "use".
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sat Feb 25, 2017 11:41 am Post subject: |
|
|
Perfect. Thanks. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Thu Mar 02, 2017 1:04 am Post subject: |
|
|
I have been puzzled by this thread.
I would have expected that INCLUDE and USE would create different variable definitions.
I think they could only be switched when they are only defining symbols.
This is a very restricted subset of module usage and could be confusing as an example.
John |
|
Back to top |
|
|
|