soccer jersey forums.silverfrost.com :: View topic - Using NAG DLLs and CHECKMATE
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 

Using NAG DLLs and CHECKMATE

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> KBase
View previous topic :: View next topic  
Author Message
silverfrost
Site Admin


Joined: 29 Nov 2006
Posts: 191
Location: Manchester

PostPosted: Thu Nov 06, 2008 3:55 pm    Post subject: Using NAG DLLs and CHECKMATE Reply with quote

When you compile your source code with an option that performs run-time checking there are subtle changes made to the way some routines are called. These changes allow run-time checking to be performed and are normally hidden from view. However, if you are trying to interface your code with DLLs produced with another compiler then you may need to give additional instructions.

For example if you want to pass a user defined function to NAG libraries compiled with Intel Visual Fortran you will need to define the function using F_STDCALL. In addition you should provide an interface in the calling routine.

The code below shows a modified example of passing a function �F� to the NAG routine C05ADF:

Code:
*     C05ADF Example Program Text
*     Mark 14 Revised. NAG Copyright 1989.
*     .. Parameters ..
      INTEGER          NOUT
      PARAMETER        (NOUT=6)
*     .. Local Scalars ..
      DOUBLE PRECISION A, B, EPS, ETA, X
      INTEGER          IFAIL
*     .. External Functions ..
      DOUBLE PRECISION F
      INTERFACE
        F_STDCALL DOUBLE PRECISION FUNCTION F(X)
        DOUBLE PRECISION            X
        END FUNCTION F
      END INTERFACE
*     .. External Subroutines ..
      EXTERNAL         C05ADF
*     .. Executable Statements ..
      WRITE (NOUT,*) 'C05ADF Example Program Results'
      A = 0.0D0
      B = 1.0D0
      EPS = 1.0D-5
      ETA = 0.0D0
      IFAIL = 1
*
      CALL C05ADF(A,B,EPS,ETA,F,X,IFAIL)
*
      WRITE (NOUT,*)
      IF (IFAIL.EQ.0) THEN
         WRITE (NOUT,99999) 'Zero at X =', X
      ELSE
         WRITE (NOUT,99998) 'IFAIL =', IFAIL
         IF (IFAIL.EQ.2 .OR. IFAIL.EQ.3) WRITE (NOUT,99999)
     +       'Final point = ', X
      END IF
*
99999 FORMAT (1X,A,F12.5)
99998 FORMAT (1x,A,I3)
      END

      F_STDCALL DOUBLE PRECISION FUNCTION F(X)
      DOUBLE PRECISION            X
      INTRINSIC                   EXP
      F = EXP(-X) - X
      END
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> KBase 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