[GHC] #11983: Can't use IntPtr or WordPtr in a foreign import

#11983: Can't use IntPtr or WordPtr in a foreign import
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: RyanGlScott
Type: bug | Status: new
Priority: normal | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
(FFI) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets: #3008, #5529
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Despite the [http://hackage.haskell.org/package/base-4.8.2.0/docs/Foreign-
Ptr.html#t:IntPtr docs claiming] that you can use `IntPtr` and `WordPtr`
to convert to and from `intptr_t` and `uintptr_t`, you can't actually do
so in a `foreign import` as of GHC 7.6. Here's a minimal example:
{{{#!hs
-- Example.hs
{-# LANGUAGE ForeignFunctionInterface #-}
module Example where
{-# INCLUDE example.h #-}
import Foreign.Ptr
foreign import ccall "intptr_example"
intPtrExample :: IntPtr -> IO ()
foreign import ccall "uintptr_example"
wordPtrExample :: WordPtr -> IO ()
}}}
{{{#!c
// example.h
#ifndef EXAMPLE_H
#define EXAMPLE_H
#include

#11983: Can't use IntPtr or WordPtr in a foreign import -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 Component: Compiler (FFI) | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #3008, #5529 | Differential Rev(s): Phab:D2142 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D2142 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11983#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11983: Can't use IntPtr or WordPtr in a foreign import
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: RyanGlScott
Type: bug | Status: patch
Priority: normal | Milestone: 8.2.1
Component: Compiler (FFI) | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #3008, #5529 | Differential Rev(s): Phab:D2142
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11983: Can't use IntPtr or WordPtr in a foreign import -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler (FFI) | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #3008, #5529 | Differential Rev(s): Phab:D2142 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11983#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC