[erlang-questions] Getting 'ei' based driver programs to run in Windows?

Serge Aleynikov <>
Wed Sep 3 04:28:31 CEST 2008


One very common cause of this in Windows programming is that you are not 
setting the binary mode on stdin/stdout file descriptors (this step is 
not necessary on UNIX).

     setmode(fileno(stdin), O_BINARY);
     setmode(fileno(stdout), O_BINARY);

Serge

Peter Smith wrote:
> Help!
> I'm trying to write a simple driver program to communicate from Erlang to my
> own program. I've read the web page at
> 
> http://www.trapexit.org/How_to_use_ei_to_marshal_binary_terms_in_port_programs
> 
> and can pretty much follow the code (I'm very new to Erlang).  After the
> obligatory compile, link, and "add a dot to the end of your line or 'erl'
> won't do anything" problems, I managed to get:
> 
>    1. erlang to start my program
>    2. my program picks up the parameters (all seventeen bytes, plus length!)
>    3. my program makes the return object
>    4. my program writes the return object (all ten bytes, plus length!)
> 
> The erlang sample program, though, doesn't ever seem to "get" the return
> object, and consequently just sits there.
> 
> Any ideas?  Is this supposed to work in windows?  Is there a way, in the
> 'receive', to print out the actual bytes receieved?  I'm using VS2005 and
> the most recent 5.6.3 Erlang binaries for windows.  I've done other IPC-type
> programming before (for the old RS/1 statistical program and others), but
> this just stumps me: I hardly know where to begin.
> 
> Thanks,
> Peter
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list