[Haskell-cafe] Unacceptable argument type in foreign declaration: Ptr ()

Sylvain Henry hsyl20 at gmail.com
Fri Jan 23 17:20:22 UTC 2015


Hi,

"dynamic" is used to convert a FunPtr into a native Haskell function.
According to [1], the first Ptr () should be something like FunPtr (Ptr ()
-> Ptr GUID -> IO Int32).

Then you have to cast the function pointer (methPtr in [2]) into a FunPtr
with Foreign.Ptr.castPtrToFunPtr.

Regards,
Sylvain

[1]
https://hackage.haskell.org/package/base-4.7.0.2/docs/Foreign-Ptr.html#g:2
[2] Lines 1420 and 1858 in
https://hackage.haskell.org/package/com-1.2.3.1/src/System/Win32/Com/Automation/TypeLib.hs

2015-01-23 8:59 GMT+01:00 Henk-Jan van Tuyl <hjgtuyl at chello.nl>:

>
> L.S.,
>
> I am trying to compile a package that hasn't been updated since 2009 and I
> get a lot of messages like:
>     Unacceptable argument type in foreign declaration: Ptr ()
>     When checking declaration:
>       foreign import stdcall safe "dynamic" prim_System_Win32_Com_
> Automation_TypeLib_setGuid
>         :: Ptr () -> Ptr () -> Ptr GUID -> IO Int32
>
> How can I correct this?
>
> Regards,
> Henk-Jan van Tuyl
>
>
> --
> Folding at home
> What if you could share your unused computer power to help find a cure? In
> just 5 minutes you can join the world's biggest networked computer and get
> us closer sooner. Watch the video.
> http://folding.stanford.edu/
>
>
> http://Van.Tuyl.eu/
> http://members.chello.nl/hjgtuyl/tourdemonad.html
> Haskell programming
> --
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150123/6713995f/attachment.html>


More information about the Haskell-Cafe mailing list