Hi,
What I tried to do was convert "String" to "ByteArray Int" using
PackedString (is there a better way ?), but this leads to an
error during link time.

Regards,
  Jan

ghc --version
        The Glorious Glasgow Haskell Compilation System, version 4.04,
patchlevel 0

gcc -version
        egcs-2.91.66

uname -sr
        SunOS 5.6

dmesg | grep SUNW
        cpu0: SUNW,UltraSPARC-IIi (upaid 0 impl 0x12 ver 0x12 clock 270
MHz)
        SUNW,m64B0 is /pci@1f,0/pci@1,1/SUNW,m64B@2
        stdout is </pci@1f,0/pci@1,1/SUNW,m64B@2> major <35> minor <0>
        SUNW,hme0: CheerIO 2.0 (Rev Id = c1) Found
        SUNW,hme0 is /pci@1f,0/pci@1,1/network@1,1
        SUNW,hme0: Using Internal Transceiver
        SUNW,hme0: 100 Mbps full-duplex Link Up

cat /etc/release 
                  Solaris 2.6 5/98 s297s_hw3smccDesktop_09 SPARC
           Copyright 1998 Sun Microsystems, Inc.  All Rights Reserved.
                           Assembled on 24 April 1998

ls
        Main.hi
        Main.hs
        Main.o
        Makefile

cat Main.hs
        module Main(main) where
        import GlaExts
        import PackedString

        cstr :: String -> ByteArray Int
        cstr = psToByteArray . packString

        hstr :: ByteArray Int -> String
        hstr = unpackPS . byteArrayToPS

        main:: IO()
        main = do {
                putStr (show (hstr (cstr "test")))
        }

cat Main.hi
        __interface Main 1  404 where
        __export Main main;
        1 main :: PrelIOBase.IO PrelBase.Z0T ;

cat Makefile
        HC=ghc
        CC=gcc
        OPT=
        GCCOPT= -O2
        OBJ= Main.o

        SUFFIXES= .o .hi .hs

        .SUFFIXES:$(SUFFIXES)

        baf : $(OBJ)
                $(RM) $@
                $(HC) -o $@ $(OPT) $(OBJ) $(LIBS)

        clean :
                $(RM) baf *.o *.hi

        .o.hi:
                @:

        .hs.o :
                $(RM) $@
                $(HC) -v -syslib misc -fglasgow-exts -c $< $(OPT)

        .c.o :
                $(RM) $@
                $(CC) -c $(INCS) $< $(GCCOPT)


make clean;make
                rm -f baf *.o *.hi
        rm -f Main.o
        ghc -v -syslib misc -fglasgow-exts -c Main.hs 
        The Glorious Glasgow Haskell Compilation System, version 4.04,
patchlevel 0

        Effective command line: -v -syslib misc -fglasgow-exts -c

        Ineffective C pre-processor:
                echo '{-# LINE 1 "Main.hs" -}' > /tmp/ghc8961.cpp && cat
Main.hs >> /tmp/ghc8961.cpp

        real        0.0
        user        0.0
        sys         0.0
        ghc:compile:Output file Main.o doesn't exist
        ghc:compile:Interface file Main.hi doesn't exist
        ghc:recompile:Input file Main.hs newer than Main.o

        Haskell compiler:
                /home/kort/ghc-4.04/lib/ghc-4.04/hsc /tmp/ghc8961.cpp 
-fglasgow-exts -fignore-interface-pragmas -fomit-interface-pragmas
-fsimplify [ -finline-phase2 -fmax-simplifier-iterations4 ]  
-fwarn-overlapping-patterns -fwarn-missing-methods
-fwarn-duplicate-exports -fhi-version=404 -static
-himap=.%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/exts%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/exts%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/misc%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/exts%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/exts%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/misc%.hi:/home/kort/ghc-4.04/lib/ghc-4.04/imports/std%.hi
   
-v -hifile=/tmp/ghc8961.hi -C=/tmp/ghc8961.hc -F=/tmp/ghc8961_stb.c
-FH=/tmp/ghc8961_stb.h +RTS -H6000000 -K1000000
        Glasgow Haskell Compiler, version 4.04, for Haskell 98, compiled
by GHC version 4.04

        real        4.1
        user        3.8
        sys         0.2

        Pin on Haskell consistency info:
                echo 'static char ghc_hsc_ID[] = "@(#)hsc Main.hs      
40.0,,";' >> /tmp/ghc8961.hc

        real        0.0
        user        0.0
        sys         0.0
        *** New hi file follows...
        __interface Main 404 where
        __export Main main;
        main :: PrelIOBase.IO PrelBase.Z0T ;


        ghc: module version changed to 1; reason: no old .hi file

        Replace .hi file, if changed:
                cmp -s Main.hi /tmp/ghc8961.hi-new || ( rm -f Main.hi &&
cp /tmp/ghc8961.hi-new Main.hi )

        real        0.0
        user        0.0
        sys         0.0

        C compiler:
                gcc -v  -S -Wimplicit -O    -I.
-I/home/kort/ghc-4.04/lib/ghc-4.04/includes
-I/home/kort/ghc-4.04/lib/ghc-4.04/includes ghc8961.c >
/tmp/ghc8961.ccout 2>&1 && ( if [ ghc8961.s != /tmp/ghc8961_o.s ] ; then
mv ghc8961.s /tmp/ghc8961_o.s ; else exit 0 ; fi )
        Reading specs from
/usr/local/arch/egcs-1.1.2/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/specs
        gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
        
/usr/local/arch/egcs-1.1.2/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/cpp
-lang-c -v -I. -I/home/kort/ghc-4.04/lib/ghc-4.04/includes
-I/home/kort/ghc-4.04/lib/ghc-4.04/includes -undef -D__GNUC__=2
-D__GNUC_MINOR__=91 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__
-D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix
-Asystem(unix) -Asystem(svr4) -D__OPTIMIZE__ -Wimplicit
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) ghc8961.c
/tmp/ccYEiRLd.i
        GNU CPP version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(sparc)
        #include "..." search starts here:
        #include <...> search starts here:
         .
         /home/kort/ghc-4.04/lib/ghc-4.04/includes
         /usr/local/include
         /usr/local/arch/egcs-1.1.2/sparc-sun-solaris2.6/include
        
/usr/local/arch/egcs-1.1.2/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/include
         /usr/include
        End of search list.
        
/usr/local/arch/egcs-1.1.2/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/cc1
/tmp/ccYEiRLd.i -quiet -dumpbase ghc8961.c -O -Wimplicit -version -o
ghc8961.s
        GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release)
(sparc-sun-solaris2.6) compiled by GNU C version egcs-2.91.66 19990314
(egcs-1.1.2 release).

        real        0.7
        user        0.4
        sys         0.1

        Unix assembler:
                gcc -o Main.o -c  -I.
-I/home/kort/ghc-4.04/lib/ghc-4.04/includes
-I/home/kort/ghc-4.04/lib/ghc-4.04/includes /tmp/ghc8961.s

        real        0.1
        user        0.0
        sys         0.0

        rm -f /tmp/ghc8961*
        rm -f baf
        ghc -o baf  Main.o 
        Undefined                       first referenced
         symbol                             in file
        PackedString_packString_closure     Main.o
        PackedString_byteArrayToPS_closure  Main.o
        PackedString_unpackPS_closure       Main.o
        PackedString_psToByteArray_closure  Main.o
        ld: fatal: Symbol referencing errors. No output written to baf
        collect2: ld returned 1 exit status
        make: *** [baf] Error 1

Reply via email to