lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, Jan 15, 2010 at 2:28 PM, Jerome Vuarand
<> wrote:
> And I guess that they're extracting (undocumented) information from
> the file userdata created by the IO library. So the issue is not to

Yes, lfs.lock and lfs.unlock extract the FILE* pointer from the file
userdata, as the POSIX lock functions need a file descriptor. File
descriptors are not ANSI C, so it is not just a question of adding a
getfd() method to Lua files... so yes, lock and unlock would work if
you compiled io as a separate dll and lfs with the same runtime as io.

I think you will still have problems with lfs.setmode, though, if you
try to use it to change the mode of io.stdin, io.stdout or io.stderr,
if you do not link the io library with the same runtime as the
executable. The program won't crash, but setmode will have no effect.

> have LFS and Lua use the same runtime, but LFS and the standard io
> module (I for one build all standard modules, including io, as
> separate DLLs).
>> Keep in mind that the
>> static single threaded C runtime is deprecated.
> I've been using the multi-threaded one.

Fabio Mascarenhas