[Haskell-cafe] FFI documentation?

2008-11-08 Thread Nun Aurbiz
Where do I find the documentation for the FFI for GHC?  I've read the FFI 
report, the GHC user guide and scoured haskell.org but they all gloss over what 
commands you actually need to give GHC and how to give them.  foreign import 
blah blah just gives me undefined references.

   ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] a minimal Windows program in Haskell?

2008-11-03 Thread Nun Aurbiz


Bulat Ziganshin [EMAIL PROTECTED] wrote:
ps: http://www.haskell.org/ghc/dist/stable/dist/ghc-6.10.1-src.tar.bz2
ghc-6.10.1\libraries\Win32\examples

Thanks for this.  

I noticed some errors in the sample that might help others:  
1) you need to replace win32 with Win32 in the given command line 
instruction
2) the Win32 package in this link gives a type error during the setup build 
phase (expecting exception and given ioerror?) but you can compile the example 
against the Win32 package in ghc 6.8.3

   ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] a minimal Windows program in Haskell?

2008-11-02 Thread Nun Aurbiz
How do I make a minimal Windows application in Haskell?  I know there are Win 
API bindings in the libraries, and of course the ffi lets you call into and out 
of C, but I have no sense of how to bring it all together.  I can't find any 
samples either.

Is the Haskell code the main application and you just ffi into the Win API?  
Or does it ffi into a win_main.c that I write?  Or is the win_main.c the main 
application and it calls into Haskell?

Here is what I am talking about by a minimal Windows application (written in 
psuedo C code).

#define WIN32_LEAN_AND_MEAN
#include windows.h

LRESULT CALLBACK windowsProcedure(..) {
switch(message) {
case WM_CLOSE:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(..);
}

int APIENTRY WinMain(..){
WNDCLASS window_class;
RegisterClass(window_class)
window = CreateWindow(..);
ShowWindow(..);

while(true) {
/* do whatever */

while(PeekMessage(..))
if(msg.message ==  WM_QUIT)
return msg.wParam;
else
DispatchMessage(msg);
}
return 0;
}



  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe