View previous topic :: View next topic |
Author |
Message |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Sat Dec 01, 2007 4:35 pm Post subject: |
|
|
Instead of using /mod_path on the FTN95 command line (directly or via a Plato build), you can create an environment variable named MOD_PATH and provide the name of a folder or a list of folders (that contains the .MOD files).
Then you will not need to use /mod_path on the command line.
You can use the environment variable when building in a DOS box (using /link) or when building a single program file (without creating a project) in Plato.
If you create a project in Plato then you must add a "Reference" for each relevant .obj file by using the "Project Explorer" window. Alternatively you can build the module(s) into a .DLL or .LIB and reference the library instead. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Mon Dec 03, 2007 11:55 am Post subject: .LIB and .MOD |
|
|
Hi Paul,
if I choose a static library (.lib) which includes a module definition, how is this then handled in a new project?
As a result I have the following 2 files for a xml parser:
If I add xmlparser.lib as a reference to my project to I still need the xmlparse.mod file?
I think my questions are very simple and the solution, but it is difficult to exactly unterstand or implement the library concepts without an example. A small example in the documentation will defenitlay help Trying all the possible combinations is also very time consuming.
Jacques |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Mon Dec 03, 2007 5:01 pm Post subject: |
|
|
You need the .MOD files at compile time because they provide information for the USE statements in your code.
You would need a reference to the library at link time because this information is required by the linker. For static libraries the object code from the library is built into your executabel by the linker. For a dynamic library the linker adds information to the executable so that the library can be linked dynamically at runtime. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Tue Dec 04, 2007 10:15 am Post subject: static library |
|
|
Hi Paul,
I created some static library from the command line using slink Code: | slink -archive:xmlparser.lib -addobj:xmlparser.obj |
Then from Plato Project -> Add References.. I linked to the xmlparser.lib file. This works ok for my application.
For better understanding could you please explain the following:
1. When should I use a static library and when a dll?
2. During a build is the source compiled and link or what happens during a biuld?
Thanks
Jacques |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Tue Dec 04, 2007 1:58 pm Post subject: |
|
|
You can also create a static library via a project in Plato.
1. Use a DLL when your library is shared by many executables and you want the executables to be small.
2. To build means to compile any files that have been changed and then link. You can also separately compile any single file. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Thu Dec 06, 2007 12:45 pm Post subject: dll |
|
|
Hi Paul,
I tried the dll as well and it works quit well!
What I would like to know is how does the final program (release) knows where to find the dll? I would think that the program will first look in the current directory for the dll. But if more than one program uses the dll it would be better to have a central copy of that. If not in the current directory, how should I solve this?
Must I "register" the dll somehow? I tried regsvr32 xml_parser.dll but get the message that the entry point was not found. What does this mean and how can I solve this?
Jacques |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Thu Dec 06, 2007 1:55 pm Post subject: |
|
|
Yes you can put the DLL in the local folder otherwise the usual place is C:\windows\system32 or its equivalent.
Basically any folder that is on the PATH environment variable. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Thu Dec 06, 2007 2:19 pm Post subject: |
|
|
Hi Paul,
and what about the entry point that is not found when I use regsvr32?
Jacques |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Thu Dec 06, 2007 6:20 pm Post subject: |
|
|
You should not be using regsrv32 in this context. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Fri Dec 07, 2007 9:45 am Post subject: |
|
|
Hi Paul,
I understand the concept much better and also tested a dll and lib in a few projects with success. If one knows what to look for you find the information in the documentation.
From another topic http://forums.silverfrost.com/viewtopic.php?t=806 you mentioned to use EXTERNAL rather than a MODULE. There is however nothing the the documentation that explains the capability.
When should I use EXTERNAL or how should I decide wheter to use EXTERNAL or MUDULE?
Jacques |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Sat Dec 08, 2007 12:29 pm Post subject: |
|
|
These are standard Fortran keywords that you will find described in a Fortran text book. |
|
Back to top |
|
|
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: Nürnberg, Germany
|
Posted: Mon Dec 10, 2007 10:34 am Post subject: Text book |
|
|
Hi Paul,
do you have any text books thsat you could recommend?
Jacques |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7929 Location: Salford, UK
|
Posted: Mon Dec 10, 2007 7:12 pm Post subject: |
|
|
"Fortran 95 Explained" by Metcalf and Reid. |
|
Back to top |
|
|
|