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 

Problem by use of two libraries

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Martin Schulz



Joined: 30 Jul 2007
Posts: 8

PostPosted: Mon Jan 07, 2008 5:11 pm    Post subject: Problem by use of two libraries Reply with quote

Hello,
several years ago my Fortran 77 programs runs on a convex under UNIX with use of NAG Fortran Mark 14.
Two libraries were linked to generate the executable. The NAG-Library and a self created library.
The self created library includs many subroutines, which used subroutines from the NAG Library.
It has been worked very well.

Now I want to restart my "old" programs again. But now I use a Notebook (AMD-Prozessor), the command line
version of the FTN95 compiler and a NAG Fortran library specially for this enviroment.

I use this batch file under DOS:
@echo off
rem Batch Datei
rem Compilieren:
FTN95 *.f95 /import_lib "C:\Program Files\NAG\FL21\fldll214zl\bin\FLDLL214Z_nag.dll"
rem Linken:
SLINK *.obj "C:\DISS\lib_dir\mslib.lib" "C:\Program Files\NAG\FL21\fldll214zl\bin\FLDLL214Z_nag.dll" -FILE:mainew
rem Löschen der Obj's:
del *.obj
rem RUN Excecutable:
mainew.exe

Compiling and Linking works very nice. But I became the following runtime error:

"Access Violation"
"The instruction at adress 036e6dd8 attemped to write to location 00000002"
" ....."

This runtime error if only occurred, when the program used a subroutine of the self created library an these subrountine
called a subroutine form NAG library. If I change my programs so that the subroutine of the NAG library is directly called from the program
then no error is indicated.

I want use again the structure with the two libraries, because it is an very complex program.
What can I do with the libraries so that they work like serveral years ago.

Thanks for any Information

Martin[/img]
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jan 07, 2008 8:51 pm    Post subject: Reply with quote

Two thoughts...

1. Is mslib.lib your own library. Is it Fortran? You may need to recompile using FTN95.

2. In any case I suggest you add /CHECKMATE to the FTN95 command line whilst testing then at least you should get more information when it crashes. Also try starting the executable up in the debugger SDBG.
Back to top
View user's profile Send private message AIM Address
Martin Schulz



Joined: 30 Jul 2007
Posts: 8

PostPosted: Tue Jan 08, 2008 10:14 pm    Post subject: Reply with quote

mslib.lib is a Fortran library and includes Fortran obj's. mslib.lib was generated through the FTN95 command "SLINK -archive:mslib.lib".
Back to top
View user's profile Send private message
Martin Schulz



Joined: 30 Jul 2007
Posts: 8

PostPosted: Sun Jan 13, 2008 7:33 pm    Post subject: Problem by use of two libraries still exist Reply with quote

Hello Paul,

thanks for your answer and your ideas. I apply your ideas but I didn't have success. I give your same more information, so I hope you have other suggestions.

This is a file in my self created Fortran library: mslib.lib. The subroutine Qd_sig use the subroutine D01AJF of the NAG library.

Code:
  Subroutine Qd_sig (Fkt, a, b, EPSAB, EPSRE, RESU)             

     IMPLICIT NONE
! --- Input / Output ---
     Real*8      Fkt, a, b               ! I: Integrand & Grenzen
     Real*8     EPSAB, EPSRE            ! I: Abs.& Rel. Genauigk.
     Real*8      RESU                    ! O: Integrations Resultat

! --- Locals of D01AJF ---
     Real*8      ABSE
     Integer     LW, LIW, IFAIL
     Parameter   ( LW = 2000, LIW = LW/2 )
     Real*8      W(LW), IW(LIW)

! --- External ---
     External    Fkt                     ! Integrand
      External    D01AJF
! --- Settings ---
     IFAIL = 1

! --- Integration ---
     Call D01AJF(Fkt, a, b, EPSAB, EPSRE, RESU, ABSE, W, LW, IW, LIW, IFAIL)

RETURN
END


Thanks in advance for any helpfull information.

Martin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jan 14, 2008 9:03 am    Post subject: Reply with quote

It looks like you are calling NAG routines from your library.

1. Are you using /import_lib when you build your library?

2. Try testing to see if you can call a NAG routine directly from your main program.
Back to top
View user's profile Send private message AIM Address
Martin Schulz



Joined: 30 Jul 2007
Posts: 8

PostPosted: Tue Jan 15, 2008 12:12 pm    Post subject: Reply with quote

Hello Paul,

thanks for your answer.

to 1.) The library mslib.lib is created without /import_lib.

to 2.) Yes, I can call NAG routines and functions from the main program.


Martin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Jan 15, 2008 1:26 pm    Post subject: Reply with quote

You need to use /import_lib when creating your library because the compiler needs to know that the NAG routines use the STDCALL protocol.
Back to top
View user's profile Send private message AIM Address
Martin Schulz



Joined: 30 Jul 2007
Posts: 8

PostPosted: Tue Jan 22, 2008 3:41 pm    Post subject: Problem by use of two libraries Reply with quote

Hello Paul,

thanks for your idea. I will test your idea, but I can't find the right command for the command line.

In the past I have used "SLINK -archive:mslib.lib".
How can I creating my library with use of /import_lib?

Thanks in advance for help.


Martin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Jan 22, 2008 6:00 pm    Post subject: Reply with quote

You need to use /import_lib when you compile your library with FTN95 just as in your initial post but there is was for the main application.
You will also need to reference the NAG dll when you apply SLINK to create the library.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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