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 

Attaching a library like NSWC to a Fortran program

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
BobFrenkel



Joined: 18 Nov 2013
Posts: 5

PostPosted: Mon Apr 23, 2018 1:59 am    Post subject: Attaching a library like NSWC to a Fortran program Reply with quote

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


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

PostPosted: Mon Apr 23, 2018 7:12 am    Post subject: Reply with quote

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



Joined: 18 Nov 2013
Posts: 5

PostPosted: Mon Apr 23, 2018 8:20 am    Post subject: NSWC library link Reply with quote

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



Joined: 31 Oct 2006
Posts: 913

PostPosted: Mon Apr 23, 2018 9:54 am    Post subject: Reply with quote

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



Joined: 10 Mar 2008
Posts: 1823
Location: South Pole, Antarctica

PostPosted: Mon Apr 23, 2018 12:44 pm    Post subject: Reply with quote

An ideal answer, mecej4.
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 -> Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
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