Extension problem (narrowed)

Yann Morvan <[email protected]>
Newsgroups gmane.comp.lang.haskell.hopengl
Message-ID <[email protected]>
I have been playing around with the extension wrapper and I feel like I am
missing something.

When I add the following code to Alpha.hs:

foreign import stdcall unsafe "dynamic" dyn_glBlendEquationEXTbogus ::
Graphics.Rendering.OpenGL.GL.Extensions.Invoker (GLenum -> IO ())

myBlendEquation2 :: GLenum -> IO ()
myBlendEquation2 val = do
   ptr <- getProcAddress "EXT" "glBlendEquationEXT"
   putStr ("Address of glBlendEquationEXT: " ++ (show ptr) ++ "\n")
   (dyn_glBlendEquationEXTbogus ptr) val

things work ok (I replace the action in blendEquation by a print so that
blending is enabled without glBlendEquation to be called through the
HOpenGL wrapper, and then I call myBlendEquation2 in the keyboard
callback to toggle between equations).

If I just move that code unchanged into PerFragment.hs,
modifying it so that the functions are exported, and importing it
explicitely in Alpha.hs, I get an access violation upon calling
myBlendEquation2.

Am I missing a GHC flag or functionnality to guide the loading of dynamic
bits of code ?
How does the program know which dll to load ?

	Yann

P.S. The code of my wrapper is a bit different from the one in
HsOpenGLExt.h, I was wary of the unsafePerformIO in there,
I hope the difference is irrelevent. If it is, tell me why.
(I know there is a loss of generality, but for the momment I am trying to
just get blendEquation to work)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.