Using GHC with Green Card under Win32
Jeremy Shute
shutej@rpi.edu
Mon, 29 Jan 2001 16:07:53 -0500
Sigbjorn:
Yes, this works perfectly now. Thanks!
I've taken the liberty of mailing this to the GHC mailing list so hopefully
it can percolate to the archives and be of use to others (I know I usually
check there first). I hope this won't be considered misuse of the list...
Thanks again!
Jeremy Shute
> -----Original Message-----
> From: Sigbjorn Finne [mailto:sigbjorn_finne@hotmail.com]
> Sent: Monday, January 29, 2001 1:21 PM
> To: Jeremy Shute
> Subject: Re: Troubles running ScriptReg
>
>
> Yes, you don't want to link against the Hugs DLL when
> you're working with ghc compiled code. Try adding
> -package greencard to the final link line.
>
> --sigbjorn
>
> ----- Original Message -----
> From: "Jeremy Shute" <shutej@rpi.edu>
> To: "Sigbjorn Finne" <sigbjorn_finne@hotmail.com>
> Sent: Monday, January 29, 2001 18:53
> Subject: RE: Troubles running ScriptReg
>
>
> > Yes, now things work wonderfully. I've written a little shell script to
> > automate the process, the .o builds fine! Now I'm trying to make use of
> the
> > library:
> >
> >
> >
> > $ ghc -static Main.hs Gimme.o -fglasgow-exts -fvia-C \
> >
> >
> '-iF:\\usr\\share\\ghc\\lib\\imports\\greencard;F:\\usr\\share\\gh
> c\\lib\\im
> > ports\\greencard'
> > Compilation IS NOT required
> > Output file not specified, defaulting to "main.exe"
> > Gimme.o(.text+0x38):ghc1140.c: undefined reference to `__init_StdDIS'
> > Gimme.o(.text+0x144):ghc1140.c: undefined reference to
> > `StdDIS_unmarshallzustringzu_closure'
> > Gimme.o(.text+0x250):ghc1140.c: undefined reference to
> > `StdDIS_unmarshallzustringzu_closure'
> > collect2: ld returned 1 exit status
> >
> >
> >
> > I've crawled the drive and found that the only C code-ish file
> for StdDIS
> > are StdDIS.dll, and that's in greencard\lib\hugs... I don't
> think linking
> > against that would be appropriate. When I omit that trailing
> '-iF:\\...',
> > the same errors are output. Sooo close!
> >
> > Perhaps I should post all this to the mailing list, just so people can
> find
> > it while crawling the archives? I would think these are fairly useful
> > nuggets of info. :-)
> >
> > Jeremy
> >
> >
> >
> > > -----Original Message-----
> > > From: Sigbjorn Finne [mailto:sigbjorn_finne@hotmail.com]
> > > Sent: Friday, January 26, 2001 12:30 PM
> > > To: Jeremy Shute
> > > Subject: Re: Troubles running ScriptReg
> > >
> > >
> > >
> > > Good to hear that you're up and running, at least on the HaskellScript
> > > side. You're close on the GC side too - to properly process the input
> > > you need to use the -i option to inform GC where it can slurp in
> > > StdDIS.gc from (Although the docs says so, the binary doesn't
> > > automatically
> > > figure this out..) So, if you invoke it as follows
> > >
> > > green-card -tghc Gimme.gc -iF:\\usr\\share\\greencard\\lib\\ghc
> > >
> > > the warning should go away. To compile Gimme.hs with ghc-4.08,
> > > use the following command-line:
> > >
> > > ghc -static -c Gimme.hs -fglasgow-exts -fvia-C \
> > >
> > > '-iF:\\usr\\share\\greencard\\lib\\ghc;F:\\usr\\share\\greencard\\
> > > lib\\ghc'
> > >
> > > i.e., you need to kludge around a bit to get DOS-style paths to work
> > > OK & redundantly give it twice, using ';' as separator.
> > >
> > > To generate Hugs-compatible output on a Win32 box, Section 12.2 of
> > > the manual contains accurate info.
> > >
> > > hth,
> > > --sigbjorn
> > >
> > > ----- Original Message -----
> > > From: "Jeremy Shute" <shutej@rpi.edu>
> > > To: "Sigbjorn Finne" <sigbjorn_finne@hotmail.com>
> > > Sent: Friday, January 26, 2001 02:56
> > > Subject: RE: Troubles running ScriptReg
> > >
> > >
> > > > Howdy, Sigbjorn.
> > > >
> > > > Confirming again that Hugs now works great with
> HaskellScript (or what
> > > I've
> > > > tested of it, at least, ;-) )...
> > > >
> > > > Now here I am, staring at Green Card, realizing that you're
> one of the
> > > > authors. You sure do get around in the Haskell world!
> > > >
> > > > I'm running GHC-4.08.1 and Green Card 2 (presumably 2.01, I
> installed
> it
> > > > right before Christmas break). I've looked at the example
> > > online of GDBM,
> > > > and am trying this code:
> > > >
> > > > ----------------------------------------
> > > > %#include "hello.h"
> > > > {-
> > > > Testing... This is Gimme.gc!
> > > > -}
> > > >
> > > > module Gimme( gimme )
> > > >
> > > > where
> > > >
> > > > import StdDIS
> > > > import Foreign( ForeignObj,
> > > > makeForeignObj )
> > > >
> > > > %fun gimme :: IO String
> > > > %code
> > > > %result (string {hello()})
> > > >
> > > > ----------------------------------------
> > > > /*
> > > > Testing... This is hello.h!
> > > > */
> > > >
> > > > char* hello( ) {
> > > > return "Howdy!\n";
> > > > }
> > > >
> > > > ----------------------------------------
> > > >
> > > > I run:
> > > >
> > > > green-card.exe -tghc Gimme.gc
> > > >
> > > > It says:
> > > >
> > > > Warning: unable to find StdDIS in:
> > > >
> > > > Notice how it says nothing after the "in"... I've scoured
> the manual
> > > > looking for ways to set the library path of green card, and
> either I'm
> > > > missing something or it's not there... Reguardless, I suppose
> > > I'm not too
> > > > TERRIBLY concerned at this stage, as I still have a
> Gimme.hs that it's
> > > > produced. The contents of which are (the comment is no longer
> correct,
> > > but
> > > > I left it reguardless):
> > > >
> > > > ----------------------------------------
> > > > {-# OPTIONS -#include "hello.h" #-}
> > > > {-
> > > > Testing... This is Gimme.gc!
> > > > -}
> > > >
> > > > module Gimme( gimme )
> > > >
> > > > where
> > > >
> > > > import StdDIS
> > > > import Foreign( ForeignObj,
> > > > makeForeignObj )
> > > >
> > > > gimme :: IO String
> > > > gimme =
> > > > _casm_ ``do {do {} while(0);} while(0);''
> > > > (unmarshall_string hello()) >>= \ gc_res1 ->
> > > >
> > > > ----------------------------------------
> > > >
> > > > That last line may wrap in your email... gimme= should be
> followed by
> 2
> > > > lines. The file's contents look OK, so I look up where StdDIS.hs is
> > > located
> > > > under my Green Card directory, stuff that onto GHC's command
> > > line, and try
> > > > to whip out an executable of some sort (using the static flag
> > > because it's
> > > > necessary under this version of GHC for Win32). Okay, so here comes
> the
> > > > part where I blame it on GHC instead of Green Card:
> > > >
> > > > I run:
> > > >
> > > > ghc -static -iF:\\usr\\share\\greencard\\lib\\ghc\\ Gimme.hs
> > > >
> > > > It says:
> > > >
> > > > Gimme.hs:15: parse error on input ``'
> > > >
> > > > I have reinstalled Green Card several times, moved things
> around, been
> > > > pretty thorough... Tried various other code, and it always
> > > lands me with
> > > > this message. I can only presume that I'm being foolish, yet again,
> and
> > > > that perhaps this newer version of GHC is mutually exclusive with
> Green
> > > > Card? Please advise.
> > > >
> > > > :-) So far, my experience with the language has been nothing but
> > > positive.
> > > > I tried out Erlang, too, and Haskell just feels cleaner.
> > > However, getting
> > > > the implementations set up is quite daunting...
> > > >
> > > >
> > > >
> > > > Jeremy Shute
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Sigbjorn Finne [mailto:sigbjorn_finne@hotmail.com]
> > > > > Sent: Wednesday, January 17, 2001 7:00 AM
> > > > > To: Jeremy Shute
> > > > > Cc: daan@cs.uu.nl; erik@cs.uu.nl
> > > > > Subject: Re: Troubles running ScriptReg
> > > > >
> > > > >
> > > > > Hi Jeremy,
> > > > >
> > > > > I don't know if anyone else has been trying to help you out,
> > > > > but the HaskellScript binary you're using is not quite
> > > > > up-to-date with the available Hugs98 binaries and libraries,
> > > > > i.e., Addr.addrToInt is a recent addition to the Addr lib.
> > > > >
> > > > > My initial suggestion would be to simply comment-out
> > > > > the 'primitive' declaration for addrToInt and try again --
> > > > > addrToInt isn't used all that much, anyway.
> > > > >
> > > > > --sigbjorn
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Jeremy Shute" <shutej@rpi.edu>
> > > > > To: <daan@cs.uu.nl>; <erik@cs.uu.nl>
> > > > > Cc: <sof@dcs.gla.ac.uk>
> > > > > Sent: Sunday, January 14, 2001 19:17
> > > > > Subject: Troubles running ScriptReg
> > > > >
> > > > >
> > > > > > I'm having some difficulty with HaskellScript under Windows 2000
> > > > > > Professional. My progress so far:
> > > > > >
> > > > > > * Downloaded and installed Hugs 98: November 1999
> version. Chose
> > > > > "typical"
> > > > > > install. Hugs resides in "C:\Hugs98".
> > > > > >
> > > > > > * Downloaded and installed HaskellScript (build 11).
> HaskellScript
> > > > > resides
> > > > > > in "C:\HScript98".
> > > > > >
> > > > > > * Started reading through the documentation and figured I'd try
> > > > > ScriptReg
> > > > > > (in the demos directory) on the included Calculator
> > > example, as noted
> > > at
> > > > > the
> > > > > > bottom of
> > > http://haskell.cs.yale.edu/haskellscript/osexamples.html. A
> > > > > popup
> > > > > > window informed me that Prelude.hs was not found. I
> > > investigated the
> > > > > > contents of my registry and determined that
> HaskellScript doesn't
> > > assume
> > > > > or
> > > > > > ask for any information about Hugs' install directory, so I came
> up
> > > with
> > > > > the
> > > > > > quick fix I've attached. Maybe you can make it useful to
> others...
> > > > > >
> > > > > > * ScriptReg now fails with a MsgBox. The title of the box is
> > > > > "HugsScript"
> > > > > > and the error message follows:
> > > > > >
> > > > > > error: ERROR "C:\Hugs98\lib\exts\Addr.hs" (line 23):
> > > Unknown primitive
> > > > > > reference "addrToInt"
> > > > > >
> > > > > > When the "OK" button is pressed, another message box pops
> > > up, this one
> > > > > > titled "ScriptReg", which states:
> > > > > >
> > > > > > Run-time error '440':
> > > > > >
> > > > > > Automation error
> > > > > >
> > > > > > * Checked out the contents of Addr.hs... Everything looks in
> > > > > order. Line
> > > > > > 14 in this file reads:
> > > > > >
> > > > > > -- data Addr -- in Prelude
> > > > > >
> > > > > > So I looked in Prelude.hs. Line 1605 of Prelude.hs reads:
> > > > > >
> > > > > > data Addr -- builtin datatype of C pointers
> > > > > >
> > > > > > Prelude.hs also contains the appropriate Standard Integral
> > > types. I'm
> > > > > left
> > > > > > wondering if Prelude.hs isn't processed before Addr.hs???
> > > This is the
> > > > > only
> > > > > > suspicion I have, maybe I've missed something?
> > > > > >
> > > > > > I would appreciate any insight you could give me: Two weeks
> > > > > from now I'm
> > > > > > starting on a web spider that's going to have to have bayesian
> > > > > classifiers
> > > > > > and neural networking components. I want to encapsulate these
> parts
> > > in
> > > > > > Haskell, but that would be a much easier case to make to my
> > > boss if my
> > > > > > coworkers could access my code from COM!
> > > > > >
> > > > > > Thanks so much!
> > > > > >
> > > > > > Jeremy
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
>