opengl - How to call a function of type Ptr GLubyte -> IO() in Haskell -



opengl - How to call a function of type Ptr GLubyte -> IO() in Haskell -

in opengl raw library next function:

glpolygonstipple :: ptr glubyte -> io ()

the c counterpart function accepts pointer array, how can phone call function array/list in haskell program?

you'll utilize mallocarray allocate memory , pokearray set list it:

http://hackage.haskell.org/packages/archive/base/latest/doc/html/foreign-marshal-array.html#v:mallocarray

something like:

do arrayofglubytes <- (mallocarray 15) :: io (ptr glubyte) pokearray arrayofglubytes [1,2,3,4] glpolygonstipple arrayofglubytes free arrayofglubytes -- free foreign.marshall.alloc

opengl haskell ffi

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -