View previous topic :: View next topic |
Author |
Message |
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Mon Jan 07, 2008 5:11 pm Post subject: Problem by use of two libraries |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Mon Jan 07, 2008 8:51 pm Post subject: |
|
|
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 |
|
|
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Tue Jan 08, 2008 10:14 pm Post subject: |
|
|
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 |
|
|
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Sun Jan 13, 2008 7:33 pm Post subject: Problem by use of two libraries still exist |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Mon Jan 14, 2008 9:03 am Post subject: |
|
|
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 |
|
|
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Tue Jan 15, 2008 12:12 pm Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Tue Jan 15, 2008 1:26 pm Post subject: |
|
|
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 |
|
|
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Tue Jan 22, 2008 3:41 pm Post subject: Problem by use of two libraries |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8036 Location: Salford, UK
|
Posted: Tue Jan 22, 2008 6:00 pm Post subject: |
|
|
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 |
|
|
|