DISLIN (external library) (SOLVED)

Forum for discussion about the documentation project.
Post Reply
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

DISLIN (external library) (SOLVED)

Post by AGS »

As I was going through the FreeBASIC documentation I found a reference to an external library called DISLIN. It's a high-level plotting library for displaying data in all chapes and forms. The library contains a lot of goodies and according to documentation it should be in the FB distribution.

I checked it out on the internet and it looked quite good. So I looked for an include file inside the FB distribution but found nothing. I looked for a static library, an import library, anything related to DISLIN inside the FB distribution and found nothing.

So I cannot help but wonder: is DISLIN in the FB distribution or not (is there an import library/static library available)? It would be great if it is (the more libraries, the better).
Last edited by AGS on Jul 03, 2008 17:17, edited 1 time in total.
maddogg6
Posts: 824
Joined: Dec 07, 2005 22:58
Contact:

Post by maddogg6 »

I have it - the .bi file is dated 12/12/2006.

/edited - removed dislin.bi file posted - because its included in FB distro's, and just wastes space/bandwidth /edit

Maybe you didnt install it when you installed FB - IIRC there where options of what to install... ??

but that file could also be a remnant from an older installation of FB I installed a newer FB onto ?? Id have to look harder to see if I have the DLL - but I dont have a .a file for it in the 'lib' folder tho /edit.
Last edited by maddogg6 on Jul 03, 2008 17:43, edited 1 time in total.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

maddogg6 wrote:I have it - the .bi file is dated 12/12/2006.

*hopes its not too big for the forum*

edit: looks like it is all there...
Maybe you didnt install it when you installed FB - IIRC there where options of what to install... ??

but that file could also be a remnant from an older installation of FB I installed a newer FB onto ?? Id have to look harder to see if I have the DLL - but I dont have a .a file for it in the 'lib' folder tho /edit.
I looked at the FBC SVN repository and it's there, the dislin.bi file! No mention of an import library, though. I checked out the versions of FB on te hdd of my PC and none have the dislin.bi file.

I should've built the import library myself to see if that works. I wonder what is the deal with this library, though. The include file is in the SVN repository, you have it but none of the versions in the 0.18.2+? branch seem to have it.

I download binaries only (maybe that's why I do not have the dislin.bi file?).
coderJeff
Site Admin
Posts: 4386
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Post by coderJeff »

dislin is an optional component in the fb windows installer. You must select it to install it. It is not installed by default but is included in the fb distribution for windows.

There would be no import library (.dll.a file) if the dislin distribution contained a static library only. (only DLLs have .def files and import libraries).
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

coderJeff wrote:dislin is an optional component in the fb windows installer. You must select it to install it. It is not installed by default but is included in the fb distribution for windows.

There would be no import library (.dll.a file) if the dislin distribution contained a static library only. (only DLLs have .def files and import libraries).
I downloaded the latest FB version, made sure I selected all of the available libraries and now I have dislin.

The (mingw) dislin distribution contains a static library only so that explains, like you said, why there is no import libary for it.

So 'problem solved' and a big thank you to Jeff and maddogg for being so helpful.
srvaldez
Posts: 3653
Joined: Sep 25, 2005 21:54

Post by srvaldez »

I went to dislin web site and downloaded both the mingw and msvc versions,
the mingw version does not have dismgc.a just dismg.a and dismg_d.a
when I tried an example using dismg.a FB gives a lot of undefined symbols,
the msvc package does have dislnc.lib plus matching dll,
after renaming dislnc.lib to libdismgc.a and moving it to FB lib\win32 folder and moving the matching dll to windows\system32 folder the
example compiles OK, but all I get as result is a meta file,
anyone knows how to output a plot window?

Code: Select all

#include "dislin.bi"

  Dim As Integer nl, ny, i, nxp
  Static ctit As Zstring*8
  Static cstr As Zstring*3
  ctit  = "Symbols"
  
  setpag("da4p")
  metafl ("cons")
  disini()
  pagera()
  complx()

  height(60)
  nl = nlmess(ctit)
  messag(ctit,(2100-nl)/2,200)

  height(50)
  hsymbl(120)

  ny = 150

  For i = 0 to 23
      if (i mod 4) = 0 then
          ny = ny + 400
          nxp = 550
      else
          nxp = nxp + 350
      end if
      cstr=str(i) 
      nl = nlmess(cstr)/2
      messag(cstr,nxp-nl,ny+150)
      symbol(i,nxp,ny)
  Next
  
  disfin()
Last edited by srvaldez on Jul 03, 2008 18:26, edited 1 time in total.
srvaldez
Posts: 3653
Joined: Sep 25, 2005 21:54

Post by srvaldez »

never mind, the C example that I translated was missing a line of code
metafl ("cons") after adding that it works!
srvaldez
Posts: 3653
Joined: Sep 25, 2005 21:54

Post by srvaldez »

here's the pie chart example

Code: Select all

#include "dislin.bi"

  Dim As Integer nya, i
  Static ctit As Zstring*20
  Static cbuf As Zstring*41
  static xray(5) As Single = {1.,2.5,2.,2.7,1.8}
  ctit  = "Pie Charts (PIEGRF)"
  nya = 2800
  
  setpag("da4p")
  metafl ("cons")
  disini()
  pagera()
  complx()
  axslen(1600,1000)
  titlin(ctit,2)
  chnpie("both")

  legini(cbuf,5,8)
  leglin(cbuf,"FIRST",1)
  leglin(cbuf,"SECOND",2)
  leglin(cbuf,"THIRD",3)
  leglin(cbuf,"FOURTH",4)
  leglin(cbuf,"FIFTH",5)

  patcyc(1,7L)
  patcyc(2,4L)
  patcyc(3,13L)
  patcyc(4,3L)
  patcyc(5,5L)

  For i = 0 To 1
    axspos(250,nya-i*1200)
    If i = 1 Then
      labels("data","pie")
      labpos("external","pie")
    End If

    piegrf(cbuf,1,@xray(0),5)

    If i = 1 Then
      height(50)
      title()
    End If
    endgrf()
  Next
  disfin()
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

srvaldez wrote:I went to dislin web site and downloaded both the mingw and msvc versions,
the mingw version does not have dismgc.a just dismg.a and dismg_d.a
when I tried an example using dismg.a FB gives a lot of undefined symbols,
Same here.
srvaldez wrote: the msvc package does have dislnc.lib plus matching dll,
after renaming dislnc.lib to libdismgc.a and moving it to FB lib\win32 folder and moving the matching dll to windows\system32 folder the
example compiles OK, but all I get as result is a meta file,
anyone knows how to output a plot window?
No no no :) You cannot use a .lib directly with MinGW. You gots to do it another way by using MinGW - tools.

First you do this:

pexports.exe dislinc.dll >dismgc.def where dislinc.dll is the VC dynamic link library.

Then you execute dlltool.exe like so:
dlltool.exe -d dismgc.def -l libdismgc.dll.a

Then you copy libdismgc.dll.a to FB lib\win32 folder and copy the VC dynamic link library (dislinc.dll) to windows\system32.

Now you can use the library with single precision (if you want double precision, use dislinc_d.dll).

Anyway, great job, srvaldez. I didn't think that I could ever get that dislin gui going.

So here is an example of a dislin gui (translated from C ;) ):

Code: Select all

#include "dislin.bi"

Dim As Integer id_lis, id_txt
Dim As String  clis = "Item 1|Item 2|Item 3|Item 4|Item 5"

Dim As Integer  ip

swgtit ("Example 3")

ip      = wgini  ("VERT")
id_lis  = wglis (ip, StrPtr(clis), 1)  

id_txt = wgtxt (ip, " ")
wgfin ()
This gives you a simple (and somewhat useless) form with a main menu, a list and an entry field. Not bad for five lines of code (never mind the var decls). And easy to remember too: wglis = list, wgtxt = text, wgini = start ("VERT" = lay out widgets vertically), wgfin() = finished with the decls, show the dialogue!
srvaldez
Posts: 3653
Joined: Sep 25, 2005 21:54

Post by srvaldez »

neat example, yeah I know the propper way is what you described, but I am lazy. :)
Post Reply