Re: Native Threads in the RTS

2002-12-01 Thread Dean Herington
On 29 Nov 2002, Alastair Reid wrote:

> Consider Haskell functions a,b,c,d and C functions A,B,C,D and a call
> pattern
> 
>   a -> A -> b -> B -> c -> C -> d -> D
> 
> That is, a calls A, calls b, calls B, calls ...
> 
> Suppose we want A,B,C,D executed by the same foreign thread.
> 
> Each of a,b,c,d are executed by different Haskell threads (because a
> new Haskell thread is spawned for each call into Haskell) so we have
> multiple Haskell threads associated with a single foreign thread.

It doesn't feel right to me that a,b,c,d are executed by different Haskell
threads.  Why shouldn't they all be the *same* Haskell thread?

1. Reasonable exception handling across the Haskell/foreign boundary is
not currently supported, but if we imagine moving in that direction, it
would seem we'd want a single thread for the given example.

2. Calling from foreign code into Haskell to a bound foreign import will
require some special handling to ensure that a subsequent call out to
foreign code will use the same native thread.  Why couldn't this special
handling select the same Haskell thread instead of creating a new one?

Dean

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



help for "Killed"

2002-12-01 Thread Dean Herington
I have a program that dies, saying simply "Killed".  How can I tell what
that means?  I presume the program is suffering a ThreadKilled exception,
and I guess it may be due to stack or heap overflow.  (The program is
processing a 50MB file.)  Profiling, even with -xc, yields no information.

Dean

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Network Programming with Haskell ?

2002-12-01 Thread John Meacham
that is what Concurrent is for, Haskell threads, (well GHC threads) are
lightweight and can be used for selectlike purposes without too much
overhead. I use them quite effectivly for complex networked
applications..

see
http://haskell.org/ghc/docs/latest/html/base/Control.Concurrent.html


On Mon, Dec 02, 2002 at 11:07:24AM +0900, Ahn Ki-yung wrote:
> No select or poll functions in Network module yet ?
> 
> listenOn and accept isn't enough for network programming.
> 
> IO multiplexing is needed.
> 
> It was a wish list.
> 
> -- 
> Ahn Ki-yung
> 
> 
> ___
> Glasgow-haskell-users mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 

-- 
---
John Meacham - California Institute of Technology, Alum. - [EMAIL PROTECTED]
---
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Network Programming with Haskell ?

2002-12-01 Thread William Lee Irwin III
On Mon, Dec 02, 2002 at 11:07:24AM +0900, Ahn Ki-yung wrote:
> No select or poll functions in Network module yet ?
> listenOn and accept isn't enough for network programming.
> IO multiplexing is needed.
> It was a wish list.

c.f. util/Select.lhs


Bill
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Network Programming with Haskell ?

2002-12-01 Thread Ahn Ki-yung
No select or poll functions in Network module yet ?

listenOn and accept isn't enough for network programming.

IO multiplexing is needed.

It was a wish list.

-- 
Ahn Ki-yung


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: Request: suppress specific warnings at specific places

2002-12-01 Thread Mike Gunter


I wrote:

> > GHC's excellent warnings are very helpful.  They would be somewhat
> > more so if it were possible to suppress a warning about a specific bit
> > of code

Then "Simon Marlow" <[EMAIL PROTECTED]> wrote:

> (of course, the workaround is to put the offending code into a module of
> its own, and use OPTIONS to turn off the appropriate warnings).

This doesn't seem to work (easily) for me.  I want -Wall applied to
all my source, so give it on the command line.  Because the OPTIONS
options get prepended, the -Wall seems to win out.  :(.  I could add
-Wall at the top of all my source files, but that's unappealing.  If
GHC provided a way to have a command-line options appear before the
OPTION options in the final list, that would work.

mike
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



5.04.1 on OS X

2002-12-01 Thread Nicolas.Oury
Hello,
is there a binary distribution for Mac OS x of GHC 5.04.1?

Best regards,
Nicolas Oury

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Calling haskell DLL from MSVC++

2002-12-01 Thread Mauricio Carvalho




Hey!
I' having problems to call functions from a DLL made with ghc 
with a C++ program, using Microsofts Visual C++
To learn how to do it, I tried the example found at 
the user's guide (11.3, 11.4), but things aren't working out.. 

Here is as far as I've done:
I have a haskell module, MyModule.hs:module 
MyModule whereforeign export stdcall fac :: Int -> 
Intfac :: Int -> Intfac n | n <= 0  = 
1 | otherwise  = n * fac(n-1)
I compile it with:  ghc -c 
MyModule.hs -fffi
 
The .c file, containing the DLL initialization 
is:
#include 
#include 
extern void __stginit_MyModule(void);
static char *args[] = {"MyDll", NULL};
BOOL STDCALL DllMain(HANDLE hModule, DWORD reason, 
void *reserved){
    int i;
    if(reason == 
DLL_PROCESS_ATTACH){
        
printf("\nStarting Haskell");
        
startupHaskell(1, args, __stginit_MyModule);
        
printf("Haskell Started!!");
        return 
TRUE;
    }
return TRUE;
}
 
Which I compile with:  ghc -c MyDll.c
I build the DLL with:  ghc 
--mk-dll -o MyDll.dll MyModule.o MyModule_stub.o MyDll.o
The DLL is build, and following the example, I try 
to call it from VB, but the program hangs. I don't know if I'm missing something 
in the building process, I can't see what it can be.
Moreover, for calling it from my C++ programs, I 
need a library file (generally called .lib in MSVC linker, I think it's 
equivalent to the libMyLib.a of gcc) to resolve the function (fac) when 
linking. I tried to use 
dlltool -b MyDll.dll -l 
MyDll.lib
to contruct the .lib file, it's contructed, but 
yet, when I use to link my C++ program with the DLL, i got unresolved external 
symbol for the function.
Thus, I can't even link the C++ program.
Note that I used the stdcall (for fac)to follow the example; I tried even 
with ccall, but without success either.
Can someone see if I'm missing something at 
the creation process of the dll? And to create the library file, is it the right 
thing to do?

Mauricio