View previous topic :: View next topic |
Author |
Message |
BobFrenkel
Joined: 18 Nov 2013 Posts: 5
|
Posted: Mon Apr 23, 2018 1:59 am Post subject: Attaching a library like NSWC to a Fortran program |
|
|
There is an extensive library NSWC (Naval Surface Warfare Computation) in Fortran for performing matrix manipulation and other complicated mathematical operations.
I would like to know how I can access particular programs within this library
from inside a FTN95 program. Example: CALL MTMS(.....) for matrix multiplication.
Thank you.
Bob Frenkel |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8012 Location: Salford, UK
|
Posted: Mon Apr 23, 2018 7:12 am Post subject: |
|
|
Bob
FTN95 can access certain third party libraries, particularly those written in C/C++. Details for 32 bit libraries can be found in FTN95.chm under Win32 platform->Mixed language programming->Calling C/C++ from FTN95.
Do you have a link to source code for the library that would provide information on how to interface to it? |
|
Back to top |
|
|
BobFrenkel
Joined: 18 Nov 2013 Posts: 5
|
Posted: Mon Apr 23, 2018 8:20 am Post subject: NSWC library link |
|
|
Paul
Thank you for your prompt reply.
When I was at the National Measurement Institute, Australia, it was simple to use the NSWC library. When executing a Fortran programme I would merely need to include the instruction -lnswc.
However, since retiring but still wishing to use Fortran for work with a colleague, I no longer have access to nswc, although I have Plato IDE on my home system and have run a few simple FTN95 programmes successfully.
Right now there is a more complicated programme involving matrices that I would like to run, but I have no access to lnswc.
Any views on how I can access the library? Thanks in advance.
Bob Frenkel |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1896
|
Posted: Mon Apr 23, 2018 9:54 am Post subject: |
|
|
Bob Frenkel posted essentially the same question over 5 years ago:
http://forums.silverfrost.com/viewtopic.php?t=2690
This is an old Fortran-66 library, still usable. The source code is available from
https://github.com/jacobwilliams/nswc/raw/master/src/nswc.f
Manual (dated 1990):
http://www.dtic.mil/dtic/tr/fulltext/u2/a476840.pdf
The file has already the correct lines selected for the machine constants in subroutines IPMPAR, SPMPAR and IPMPAR. Just compile and link the source file into a DLL:
ftn95 nswc.f /si /opt /p6
slink /dll nswc.obj /exportall
From this point on, to link any of your programs that call one of the NSWC routines, simply specify the name of the DLL in the linking command:
ftn95 myNSWCX.f90
slink myNSWCX.obj NSWC.DLL
Note that listing the name of the DLL in the SLINK command line serves the same purpose as the Unix Fortran compiler option -lnswc.
You can take the corresponding steps in 64-bit mode, if you prefer.
Last edited by mecej4 on Mon Apr 23, 2018 5:57 pm; edited 1 time in total |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2865 Location: South Pole, Antarctica
|
Posted: Mon Apr 23, 2018 12:44 pm Post subject: |
|
|
An ideal answer, mecej4. |
|
Back to top |
|
|
|