[Haskell-cafe] Re: HDirect, [unique], troubles again!
Sigbjorn Finne
sof at galois.com
Thu May 6 11:51:49 EDT 2004
Two things not quite working out here:
- HDirect treated 'unique' as 'ref' for function pointers;
that's easier to work with if 'unique' was the inferred/default
kind, but clearly not what you want if you explicitly supplied
a 'unique' attribute.
- The by-ref marshallers for function types have types with shapes
slightly different from other by-ref marshallers. Hence, extra
care is required when emitting marshallers for types that contain
them.
Both of these issues have now been fixed in the CVS repository.
--sigbjorn
----- Original Message -----
From: "Vincenzo aka Nick Name" <vincenzo_mlRE.MOVE at yahoo.it>
To: <haskell-cafe at haskell.org>
Cc: "Sigbjorn Finne" <sof at galois.com>
Sent: Wednesday, May 05, 2004 13:51
Subject: HDirect, [unique], troubles again!
> In my quest for a fuse binding for Haskell, which I really need at the
> moment, I have the following definition working:
>
> module HSFuse {
> interface stat{};
>
> typedef int getattrT([string] char *,stat);
>
> typedef struct fuseOps {
> [ref] getattrT * getattr;
> } fuseOps;
>
> void fuse_main(int argc,[in,string,size_is(argc)]char** argv,[ref]
> fuseOps * op);
> };
>
> but when I substitute "ref" with "unique", because some operations can
> be null, I get the errors below. The problem is that in the generated
> hs file there is
>
> data FuseOps = FuseOps {getattr :: GetattrT}
>
> which completely ignores my type declaration! Did I do something wrong?
>
> Commands invoked and errors follow, thanks for attention:
>
> ihc -fhs-to-c -fuse-ints-everywhere -c HSFuse.idl
> ghc -package hdirect -fglasgow-exts HSFuse.hs -c
>
> HSFuse.hs:136:
> Couldn't match
> `GHC.Base.String -> Stat -> GHC.IOBase.IO GHC.Base.Int'
> against
> `GHC.Ptr.Ptr
> (GHC.Base.String -> Stat -> GHC.IOBase.IO GHC.Base.Int)'
> Expected type: GHC.Ptr.Ptr
> (GHC.Ptr.Ptr
> (GHC.Base.String -> Stat ->
> GHC.IOBase.IO GHC.Base.Int))
> -> GHC.Ptr.Ptr
> (GHC.Base.String -> Stat -> GHC.IOBase.IO
> GHC.Base.Int)
> -> GHC.IOBase.IO ()
> Inferred type: GHC.Ptr.Ptr
> (GHC.Ptr.Ptr
> (GHC.Base.String -> Stat ->
> GHC.IOBase.IO GHC.Base.Int))
> -> (GHC.Base.String -> Stat -> GHC.IOBase.IO
> GHC.Base.Int)
> -> GHC.IOBase.IO ()
> In the second argument of `HDirect.writeunique', namely
> `writeGetattrT'
> In the definition of `writeFuseOps':
> writeFuseOps ptr (FuseOps getattr)
> = let
> pf0 = ptr
> pf1 = HDirect.addNCastPtr pf0 0
> in
> HDirect.writeunique (HDirect.allocBytes
> (GHC.Real.fromIntegral sizeofGetattrT))
> writeGetattrT
> pf1
> getattr
More information about the Haskell-Cafe
mailing list