|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
cseeton
Joined: 24 Sep 2006 Posts: 1
|
Posted: Mon Dec 11, 2006 6:50 am Post subject: Creating a dll trouble |
|
|
I am having trouble creating a dll to call from EES (engineering equation solver). In the past, I have created in MS VFortran and Compaq VF the following:
The trouble is - what do I use change the !MS$attributes alias and dllexport to generate the same dll.
Any help is greatly appriciated!
Chris
SUBROUTINE MDASF(S,MODE,NINPUTS,INPUTS,NOUTPUTS,OUTPUTS)
C. The following two lines are specific to Microsoft Visual Fortran
!MS$ATTRIBUTES ALIAS:'MDASF' :: MDASF
!MS$ATTRIBUTES DLLEXPORT :: MDASF
INTEGER(4) MODE, NINPUTS, NOUTPUTS
REAL(8) INPUTS(50), OUTPUTS(50)
CHARACTER(255) S
C.
IF (MODE.EQ.-1) GOTO 900
IF (NINPUTS.NE.2) GOTO 100
IF (NOUTPUTS.NE.4) GOTO 200
C. DO CALCULATIONS
X=INPUTS(1)
Y=INPUTS(2)
IF (ABS(Y).LE.1E-9) GOTO 300
OUTPUTS(1)=X*Y
OUTPUTS(2)=X/Y
OUTPUTS(3)=X+Y
OUTPUTS(4)=X-Y
MODE=0
S=''C
RETURN
100 CONTINUE
C. ERROR: THE NUMBER OF INPUTS ISN'T WHAT THIS SUBROUTINE EXPECTS
C. NOTE: SET MODE>0 IF AN ERROR IS DETECTED. IF S IS EQUAL TO A
C. NULL STRING, THEN EES WILL DISPLAY THE MODE NUMBER IN AN ERROR
C. MESSAGE. IF S IS DEFINED, EES WILL DISPLAY THE STRING IN THE
C. ERROR MESSAGE. THE C AT THE END OF THE STRING INDICATES C-STYLE
C. S='MDASF REQUIRES 2 INPUTS'C
MODE=1
RETURN
200 CONTINUE
S='MDASF EXPECTS TO PROVIDE 4 OUTPUTS'C
MODE=2
RETURN
300 CONTINUE
S='DIVISION BY ZERO IN MDASF'C
MODE=3
RETURN
900 CONTINUE
C. PROVIDE AN EXAMPLE OF THE CALLING FORMAT WHEN MODE=-1
S='CALL MDASF(X,Y:A,B,C,D)'C
RETURN
END
The following statement in an EES program will call this file.
CALL MDASF(X,Y : M, D, A, S) |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Mon Dec 11, 2006 9:00 am Post subject: |
|
|
FTN95 has its own set of comment embedded directives that are listed in the help file ftn95.chm. Under Win32 there is no alias mechanism unless you use the advanced features of the linker SLINK. By default all names are exported in upper chase.
The simplest way to create an appropriate DLL is to use EXPORTALL in the SLINK commands. This is available as a project setting from both Visual Studio and Plato.
If you are accessing a third party DLL then it is likely that it has been created using the STDCALL protocol. In this case you should use /IMPORT_LIB <dllname> on the command line. Alternatively, when creating a project in Plato, you can add a "Reference" and use its Properties dialog to make it "STDCALL". |
|
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
|