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 

Converting "include" to "use"
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
EKruck



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

PostPosted: Wed Feb 22, 2017 10:21 am    Post subject: Converting "include" to "use" Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 22, 2017 11:35 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Wed Feb 22, 2017 1:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 22, 2017 4:52 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
EKruck



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

PostPosted: Thu Feb 23, 2017 10:11 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Feb 23, 2017 11:38 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Thu Feb 23, 2017 12:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
EKruck



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

PostPosted: Thu Feb 23, 2017 12:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Thu Feb 23, 2017 1:20 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Thu Feb 23, 2017 2:25 pm    Post subject: Reply with quote

Hi Paul,

Thanks for the clarification.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Feb 23, 2017 6:42 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
EKruck



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

PostPosted: Fri Feb 24, 2017 10:28 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sat Feb 25, 2017 9:14 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message AIM Address
EKruck



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

PostPosted: Sat Feb 25, 2017 11:41 am    Post subject: Reply with quote

Perfect. Thanks.
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Mar 02, 2017 1:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
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