----- Original Message -----
From: "Vladimir Lipskiy" <[EMAIL PROTECTED]>
To: "Jonathan Worthington" <[EMAIL PROTECTED]>
Cc: "perl6-internals" <[EMAIL PROTECTED]>
Sent: Monday, September 08, 2003 12:39 AM
Subject: Re: Running .pbc files on Win32 and PIO_win32_open


> > Hi,
>
> Hi
>
> > Now, the file is certainly there.  So what gives?  I eventually traced
the
> > problem down to PIO_win32_open, where I found this:-
>
> No, CreateFile is okay. The problem is in languages/imcc/main.c
>
> > According to:
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/
> > system_error_codes.asp
> > That error code means:-
> >     The process cannot access the file because it is being used by
another
> > process.
>
> Or the same process tries to open one more descriptor of the file.
*nods*  Yes, I was just quoting the docs.  :-)

> > Then it works.  However, I suspect that isn't the solution, as the file
> > must be being opened somewhere twice
>
> Yup. That's what's going on as a matter of fact.
I wasn't sure as I didn't think PIO_win32_open was getting called twice,
though a double open seemed the only reasonable explanation...

> > I've attached the change I did as a patch on the off-chance you want to
> > apply it, although I'm still not convinced it's the real solution.  :-)
>
> IMHO, a solution  might be
>
> Index: languages/imcc/main.c
> ===================================================================
> RCS file: /cvs/public/parrot/languages/imcc/main.c,v
> retrieving revision 1.46
> diff -u -r1.46 main.c
> --- languages/imcc/main.c       3 Sep 2003 11:42:43 -0000       1.46
> +++ languages/imcc/main.c       7 Sep 2003 22:31:35 -0000
> @@ -449,11 +449,11 @@
>              info(interpreter, 1,"\n");
>      }
>      if (run_pbc == 2) {
> +        fclose(yyin);
>          pf = Parrot_readbc(interpreter, sourcefile);
>          if (!pf)
>              fatal(1, "main", "Packfile loading failed\n");
>          Parrot_loadbc(interpreter, pf);
> -        fclose(yyin);
>      }
>      else {
>          int per_pbc = write_pbc | run_pbc;
That looks more like it to me.

Thanks,

Jonathan


Reply via email to