in reply to Re^5: fcntl failure after eval
in thread fcntl failure after eval

man fcntl says the even the order of the fields if system specific. Padding between the fields is compiler and system specific. The size of some of these fields is system specific.

Does perl not know what this type is

Perl surely does #include <fcntl.h>, so it does know.

I guess there's no portable pure perl solution?

fcntl itself is not portable.

Aside from that, it's most definitely possible.

You're asking for a Pure Perl way of getting the structure your C compiler would created from the info the system provides in fcntl.h.

Perl (via Config) does provide the info you need to launch the C compiler using system, although Inline::C will simplify the process.

This could even be done by your installer.

You could even do this at development time. Perl (via Config) does specify which compiler and system it's running on, so you could look up the right structure at run-time.

That's a bit of a pain

That the system specifies its input as compiler-specific C code? yeah.

Replies are listed 'Best First'.
Re^7: fcntl failure after eval
by Anonymous Monk on Aug 12, 2011 at 20:12 UTC

    So the reason you don't hit this problem with most system/library calls is that they take simple datatypes rather than structs?

    If so, how come this isn't an issue with readdir()? The manpage says that needs a structure also...
      The argument of the readdir system call is a file descriptor, and Perl passes that to it. The last argument of fcntl system call is a pointer to a series of bytes of no defined format. Perl allows you to pass that to it.