Jano Svitok wrote:
> On 9/5/07, Luc Holtkamp <lholtkamp / moog-fcs.com> wrote:
>> Hi,
>>
>> We embedded Ruby 1.3.29 in a Windows XP application, and sometimes we
>> get strange errors back from the Ruby interpreter.
>>
>> The error we get is something like:
>> #<Errno::EBADF: (eval):3702:in `write'Bad file descriptor>
>> Where the number (3709) varies.
> 
> Can you check line #3702 of your eval'ed script if there's "write" by
> any chance?
> Can you post preferably smallest script that produces this error, or
> at least few lines before and after where the error happens?
> 
> NB: I guess 1.3.29 is SWIG version not RUBY...
> 
> J.

Hi Jano,

Yes, the 1.3.29 is indeed SWIG, sorry for the confusion
We use:
SWIG Version 1.3.29 Compiled with g++ [i686-pc-cygwin]
ruby 1.8.1 (2003-12-25) [i386-mswin32]

The script itself is very simple, just one line:

Fcstest::Log ("Test 123")

The Fcstest::Log function was wrapped with SWIG. When I tested with this 
script I got error such as:
 #<Errno::EBADF: (eval):190:in `write'Bad file descriptor>
 #<Errno::EBADF: (eval):380:in `write'Bad file descriptor>

If a add more lines to the script I get the errors more often, and the 
numbers tend to be higher.

Maybe ruby tries to write to the console? It's a windows app, so it has 
no console. But normally the calls to puts() don't cause any problems if 
you have no console, at least not in C++.

Luc


-- 
Posted via http://www.ruby-forum.com/.