forums.silverfrost.com
Welcome to the Silverfrost forums

 Converting "include" to "use" Goto page 1, 2  Next
Author Message
EKruck

Joined: 09 Jan 2010
Posts: 181
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 include include include include
Can I change all of them and use modules instead? Which modules?
PaulLaidler

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

Posted: Wed Feb 22, 2017 11:35 am    Post subject:

For Silverfrost compilers...

 Code: INCLUDE      USE clrwin INCLUDE      USE mswin32 INCLUDE      USE msw32prm INCLUDE       USE mswin INCLUDE        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.
LitusSaxonicum

Joined: 23 Aug 2005
Posts: 1827
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
PaulLaidler

Joined: 21 Feb 2005
Posts: 5463
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 , 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.
EKruck

Joined: 09 Jan 2010
Posts: 181
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
PaulLaidler

Joined: 21 Feb 2005
Posts: 5463
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.
LitusSaxonicum

Joined: 23 Aug 2005
Posts: 1827
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
EKruck

Joined: 09 Jan 2010
Posts: 181
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           ::

I changed include opengl to USE ...

Result:
D:\Bgo_7.0\3dView\3dReadData.F90(6) : error 404 - Cannot find definition for MODULE OPENGL
Compilation failed.
PaulLaidler

Joined: 21 Feb 2005
Posts: 5463
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.
LitusSaxonicum

Joined: 23 Aug 2005
Posts: 1827
Location: Yateley, Hants, UK

 Posted: Thu Feb 23, 2017 2:25 pm    Post subject: Hi Paul, Thanks for the clarification.
PaulLaidler

Joined: 21 Feb 2005
Posts: 5463
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 instead of USE opengl. Failing that, please send me a short working program that demonstrates the failure.
EKruck

Joined: 09 Jan 2010
Posts: 181
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
PaulLaidler

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

 Posted: Sat Feb 25, 2017 9:14 am    Post subject: Erwin These files should be in \Program Files (x86) \Silverfrost\FTN95\include but here is a link to download them files if they are missing. https://www.dropbox.com/s/0zizieww1zteh59/opengl.zip?dl=0
EKruck

Joined: 09 Jan 2010
Posts: 181
Location: Aalen, Germany

 Posted: Sat Feb 25, 2017 11:41 am    Post subject: Perfect. Thanks.
JohnCampbell

Joined: 16 Feb 2006
Posts: 1974
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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 HourGoto page 1, 2  Next Page 1 of 2