Re: GHC version 5.00.2 is available

2001-06-20 Thread Josef Svenningsson

On Mon, 18 Jun 2001, Julian Seward (Intl Vendor) wrote:


The (Interactive) Glasgow Haskell Compiler -- version 5.00.2
   ==

[..]

  What's new in 5.00.2
 ==

[..]

How about Andrew Tolmach's -fext-core flag? Did it make it into 5.00.2 or
do we have to wait for next official release?

/Josef


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



passing Strings with FFI

2001-06-20 Thread Corneliu Popeea

Hello,

I want to pass a String to a function which is imported from C code:
foreign import  pass prim_pass :: String - String
The declaration above gives me an error from ghc like String type not 
supported for imported functions.
I thought that String being [Char] should be supported (somehow like a 
definition with newtype keyword).
Can you tell me how can I pass strings to and from C code, as simple as 
possible (I know about HDirect, but I couldn't make it work for me: red-hat 
7.1, ghc 5.00)?

Best regards,
Corneliu


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: passing Strings with FFI

2001-06-20 Thread Julian Seward (Intl Vendor)


| I want to pass a String to a function which is imported from C code:
|   foreign import  pass prim_pass :: String - String
| The declaration above gives me an error from ghc like String 
| type not 
| supported for imported functions.
| I thought that String being [Char] should be supported 
| (somehow like a 
| definition with newtype keyword).
| Can you tell me how can I pass strings to and from C code, as 
| simple as 
| possible (I know about HDirect, but I couldn't make it work 
| for me: red-hat 
| 7.1, ghc 5.00)?

First of all, upgrade to 5.00.2, since it is significantly less
buggy than 5.00.


int fooble ( char* str, int n )
{
   fprintf(stderr, fooble called: %s %d\n, str, n );
   return 42;
}


import PrelByteArr
import PrelPack (packString)

foreign import fooble fooble
   fooble :: PackedString - Int - IO Int

type PackedString = ByteArray Int

main = do n - fooble (packString hello, C world) 99
  putStrLn (Returned value is  ++ show n)

For more examples read the compiler sources, at 
fptools/ghc/compiler/ghci/Linker.lhs.

J

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users