 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Tue Jan 29, 2008 7:36 pm Post subject: Parameters of subroutines |
|
|
Hi, if a call the NAG-subroutine D01AJF directly from the main program it works well. But an "Access Violation" is accured if D01AJF called from Qd-sig. The problem is to give the name of the function "Fst" via Qd-sig to D01AJF.
Code: | PROGRAM MAINEW
IMPLICIT NONE
! --- Input / Output ---
Real*8 Fst, a, b ,RESU ! I: Integrand & Grenzen
! --- Locals of D01AJF ---
Real*8 EPSAB, EPSRE ! Abs.&Rel. Genauigk.: sig
Parameter ( EPSAB = 0.D0, EPSRE = 1.D-4 )
Integer LW, LIW, IFAIL
Parameter ( LW = 800, LIW = LW/4 )
Real*8 W(LW), ABSE
Integer IW(LIW)
! --- External ---
External Fst, D01AJF, Qd_sig ! Integrand
! --- Settings ---
IFAIL = 1
a = 0.D0
b = 2 * 3.14D0
! --- Integration ---
Call D01AJF(Fst, a, b, EPSAB, EPSRE, RESU, ABSE, W, LW, IW, LIW, IFAIL)
PRINT*,'D01AJF-RESU =',RESU
Call Qd_sig(Fst, a, b, EPSAB, EPSRE, RESU)
PRINT*,'Qd_sig-RESU =',RESU
END |
Code: | Subroutine Qd_sig (Fkt, a, b, EPSAB, EPSRE, RESU)
IMPLICIT NONE
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 ---
Integer LW, LIW, IFAIL
Parameter ( LW = 800, LIW = LW/4 ) !Zu Testzwecken
Real*8 W(LW), Fkt, ABSE
Integer IW(LIW)
! --- External ---
External Fkt, D01AJF ! Integrand
! --- Settings ---
IFAIL = 1
Call D01AJF(Fkt, a, b, EPSAB, EPSRE, RESU, ABSE, W, LW, IW, LIW, IFAIL)
Return
END
|
How can I solve my problem?
Thanks in advance for any idea.
regards Martin |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8121 Location: Salford, UK
|
Posted: Tue Jan 29, 2008 8:03 pm Post subject: |
|
|
The NAG routines will use STDCALL.
Most users use /import_lib on the FTN95 command line and link together using the NAG DLL.
You will need to do something like this for the main program and any libraries that call the NAG routines.
In a Plato project you can use the Properties of a DLL Reference for this purpose. |
|
Back to top |
|
 |
Martin Schulz
Joined: 30 Jul 2007 Posts: 8
|
Posted: Thu Jan 31, 2008 7:30 pm Post subject: Parameters of subroutines |
|
|
Hello Paul,
I tried all your suggestions and also your sugesstions from my posted "Problem of two libraries".
I have examinate Qd-sig from my Fortran library to focus the problem. The main problem is to give a name of a function (Fst) via a subroutine (Qd_sig) to the NAG-subroutine.
If I examinate Fst from the parameter list in Qd-sig and give the name dircet to the NAG-subroutine, then it works.
I use /import_lib for any compilation.
Thanks in advance or any idea
regards Martin |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8121 Location: Salford, UK
|
Posted: Fri Feb 01, 2008 9:25 am Post subject: |
|
|
If you are passing an FTN95 subroutine to a NAG library routine then I would expect that it should be declared as F_STDCALL in your code.
I have never tried to do this but logically it is what one would expect.
It would look like this in your code...
F_STDCALL SUBROUTINE foo(x)
REAL x
... |
|
Back to top |
|
 |
|
|
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
|