Unacceptable argument type in foreign declaration: Ptr ()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unacceptable argument type in foreign declaration: Ptr ()

Henk-Jan van Tuyl

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@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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Unacceptable argument type in foreign declaration: Ptr ()

Sylvain HENRY
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 <[hidden email]>:

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@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
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe