In any case, what I want to do is store FunPtr in a data type and marshall
into a C struct as a C function pointer.
Vasili
On Mon, Jun 9, 2008 at 1:24 AM, Galchin, Vasili <[EMAIL PROTECTED]> wrote:
> Thanks. Clause?
>
> regards, Vasili
>
>
> On Mon, Jun 9, 2008 at 12:54 AM, Bulat Ziganshin <
> [EMAIL PROTECTED]> wrote:
>
>> Hello Vasili,
>>
>> Monday, June 9, 2008, 6:17:14 AM, you wrote:
>>
>> 1. standard place to import FunPtr from is Foreign.Ptr, not System.Posix
>> 2. FunPtr is exported as abstract type, without constructors. you
>> can't construct values of this type directly. instead you should use
>> "wrapper" generators as in the example that Clause has wrote. read it
>> carefully :)
>>
>>
>> > Hello,
>>
>> > I am getting what is to me a mysterious error in a test case that I
>> am writing:
>> > [EMAIL PROTECTED]:~/FTP/Haskell/unix-2.2.0.0/tests/timer$ runhaskell
>> Setup.lhs build
>> > Preprocessing executables for Test-1.0...
>> > Building Test-1.0...
>> > [1 of 1] Compiling Main ( ./timer.hs,
>> > dist/build/timer/timer-tmp/Main.o )
>>
>> > ./timer.hs:11:45: Not in scope: data constructor `FunPtr'
>>
>> > It seems like the compiler is complaining about the lack of FunPtr
>> > in it's symbol table but System.Posix is imported:
>> >
>> > module Main where
>>
>> > import System.Posix
>> > import Foreign
>> > import Foreign.C
>> > import Foreign.Ptr
>>
>> > main = do
>>
>> > let event = Sigevent{sigevFunction=(FunPtr (notifyFunc))}
>> <<<<<< error here
>> >
>> > timerId <- timerCreate Clock_Realtime Nothing
>>
>> > timerDelete timerId
>>
>> > return ()
>>
>> > notifyFunc :: Sigval -> IO ()
>> > notifyFunc sigval = do
>> > putStrLn "timer POP!!!!!!!"
>> > return ()
>>
>> > I am probably looking right at the answer and not seeing it. ??
>>
>> > Thanks, Vasili
>>
>>
>>
>> >
>>
>>
>> --
>> Best regards,
>> Bulat mailto:[EMAIL PROTECTED]
>>
>>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe