DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fortran Compiler Compatability

 
Post new topic   Reply to topic    DPlot Forum Index -> Fortran
View previous topic :: View next topic  
Author Message
milo



Joined: 09 Mar 2004
Posts: 5

PostPosted: Tue Mar 09, 2004 2:42 pm    Post subject: Fortran Compiler Compatability Reply with quote

I can confirm that the sample source FTEST.FOR will work properly without changes with the latest version of Open Source WATCOM Fortran, namely version 1.2.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Tue Mar 09, 2004 2:55 pm    Post subject: Reply with quote

Thanks for the confirmation. It has been a while since I looked at Open Source WATCOM... did you see this note in the source:

c 3) This source code will work properly without changes with Open Source WATCOM Fortran 1.0. HOWEVER,
c the supplied import library (DPLOTLIB.LIB) will NOT work with that compiler. To build FTEST with
c Open Source WATCOM Fortran, first delete the import library DPLOTLIB.LIB, then build a new one
c using the WATCOM library tool WLIB.EXE:
c
c wlib dplotlib +dplotlib.dll

... and was this necessary for version 1.2 or not?
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
milo



Joined: 09 Mar 2004
Posts: 5

PostPosted: Thu Mar 11, 2004 3:00 pm    Post subject: Reply with quote

I had taken note of the information you provided in the source. Having built a new library for version 1.1, I simply proceeded to do the same with the release of version 1.2. I did not have any problems in either case.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Thu Mar 11, 2004 3:03 pm    Post subject: Reply with quote

Thanks for the info.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
milo



Joined: 09 Mar 2004
Posts: 5

PostPosted: Sat Feb 19, 2005 2:05 pm    Post subject: Reply with quote

Just completed test of a Win32 Fortran 95 program using Salford FTN95 Compiler, Version 4.7.1. Obtained compatability using Salford's external C/C++ routine and DPLOTLIB.DLL. The routine C_EXTERNAL name ['alias'][(desc)][:restype] allows for the case sensitive call to the external name Dplot_Plot.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Sat Feb 19, 2005 5:17 pm    Post subject: Reply with quote

Thanks... this is weirdly timely, as I just downloaded Salford FORTRAN yesterday and worked a few things out last night. Another user had much earlier sent me example source meant for Salford FORTRAN, but w/o being able to test it I didn't feel comfortable including it in the distribution.

You'll find that C_EXTERNAL isn't quite right. That uses normal C calling conventions (caller responsible for removing arguments from the stack) rather than STDCALL (called function removes arguments from the stack). What you'll get with C_EXTERNAL is everything works right until after you return from calling DPlot_Plot (or whatever) the first time. Subsequent calls may crash your program or may simply produce goofy looking plots.

I'll be including a Salford FORTRAN example in the next release - most likely within the next few days. In the meantime, the correct interface for all existing DPLOTLIB functions is:

Code:
c
c Interface to DPLOTLIB functions
c
      STDCALL DPLOT_3DBORDER 'DPlot_3DBorder' (VAL, VAL, REF): INTEGER*4
      STDCALL DPLOT_ADDDATA 'DPlot_AddData' (VAL, VAL, VAL, VAL,
     &                          REF, REF): INTEGER*4
      STDCALL DPLOT_ADDDATA8 'DPlot_AddData8' (VAL, VAL, VAL, VAL,
     &                          REF, REF): INTEGER*4
      STDCALL DPLOT_COMMAND 'DPlot_Command' (VAL, INSTRING): INTEGER*4
      STDCALL DPLOT_GETBITMAP 'DPlot_GetBitmap' (VAL, VAL, VAL):
     &                          INTEGER*4
      STDCALL DPLOT_GETBITMAPEX 'DPlot_GetBitmapEx'
     &                          (VAL, VAL, VAL, REF): INTEGER*4
      STDCALL DPLOT_GETENHMETAFILE 'DPlot_GetEnhMetaFile'
     &                          (VAL, VAL, VAL): INTEGER*4
      STDCALL DPLOT_GETVERSION 'DPlot_GetVersion' (OUTSTRING): INTEGER*4
      STDCALL DPLOT_PLOT 'DPlot_Plot' (REF, REF, REF, INSTRING):
     &                          INTEGER*4
      STDCALL DPLOT_PLOT8 'DPlot_Plot8' (REF, REF, REF, INSTRING):
     &                          INTEGER*4
      STDCALL DPLOT_PLOT8P 'DPlot_Plot8p' (REF, VAL, VAL, INSTRING):
     &                          INTEGER*4
      STDCALL DPLOT_PLOTBITMAP 'DPlot_PlotBitmap' (REF, REF, REF,
     &                          INSTRING, VAL, VAL): INTEGER*4
      STDCALL DPLOT_PLOTBITMAP8 'DPlot_PlotBitmap8' (REF, REF, REF,
     &                          INSTRING, VAL, VAL): INTEGER*4
      STDCALL DPLOT_PLOTTORECT 'DPlot_PlotToRect' (REF, REF, REF,
     &                          INSTRING, VAL, REF): INTEGER*4
      STDCALL DPLOT_PLOTTORECT8 'DPlot_PlotToRect8' (REF, REF, REF,
     &                          INSTRING, VAL, REF): INTEGER*4
      STDCALL DPLOT_REQUEST 'DPlot_Request' (VAL, INSTRING, OUTSTRING,
     &                          REF): INTEGER*4
      STDCALL DPLOT_SETERRORMETHOD 'DPlot_SetErrorMethod' (VAL)
      STDCALL DPLOT_START 'DPlot_Start' (VAL, REF): INTEGER*4
      STDCALL DPLOT_STOP 'DPlot_Stop'
      STDCALL DPLOT_ZFROMXY 'DPlot_ZFromXY' (VAL, VAL, VAL, REF):
     &                          INTEGER*4

_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
milo



Joined: 09 Mar 2004
Posts: 5

PostPosted: Tue Feb 22, 2005 4:40 pm    Post subject: Reply with quote

I take note of what you say, namely:"You'll find that C_EXTERNAL isn't quite right. That uses normal C calling conventions (caller responsible for removing arguments from the stack) rather than STDCALL (called function removes arguments from the stack). What you'll get with C_EXTERNAL is everything works right until after you return from calling DPlot_Plot (or whatever) the first time. Subsequent calls may crash your program or may simply produce goofy looking plots. ". I have not had, however, any problems with repeat calls of the examples that create the 4 sample plots in the Fortran 95 "test" program that I used.

I did have problems with a Fortran 77 code that used an include file and with a DPLOT structure that is created using a common block. The Fortran 95 code uses modules. In any event, will test the sample which you are making available in the current distribution.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Tue Feb 22, 2005 5:04 pm    Post subject: Reply with quote

Quote:
I have not had, however, any problems with repeat calls of the examples that create the 4 sample plots in the Fortran 95 "test" program that I used.


I don't have a good explanation for that, unless it is that there's a compiler switch that self-corrects the stack pointer. In any case STDCALL is definitely the correct convention to use.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
milo



Joined: 09 Mar 2004
Posts: 5

PostPosted: Tue Feb 22, 2005 11:45 pm    Post subject: Reply with quote

The sample problem you provide with the latest release eliminates the problem that I experienced with the Fortran 77 test case.

I should have added that the Fortran 95 test case sets up the Dplot stucture prior to each call to Dplot_Plot and uses allocatable arrays in each of the four examples for the data generated. Their rank has been specified when they are declared but their bounds, within the case construct, are defined with an allocate statement at the commencement of each "case" and deallocated prior to the end of each "case". In other words, fresh storage is established prior to each call to Dplot_Plot and discarded prior to a subsequent call. As a consequence, the problem, to which you make reference, does not occur in the Fortran 95 test case.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Fortran All times are GMT - 5 Hours
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