Bernd Paysan <[EMAIL PROTECTED]> writes:

> On Wednesday 05 April 2006 19:13, Robert Epprecht wrote:
>> Bernd Paysan <[EMAIL PROTECTED]> writes:

>> How can I access errno?
>
> Under Linux, the function __errno_location returns a pointer to errno.

Thank you.


> However, your declaration is wrong. You say int int ptr, but the 
> signature of open() is ptr int int. Gforth reverses C's stack, so you 
> really have to pass the pointer to the string first, and then the 
> integer arguments.

now I'm quite confused ;-)

I have found this declaration in lib.fs CVS-1.15
libc open  int int ptr (int) open


When you say
> you really have to pass the pointer to the string first, and then the
> integer arguments.
do you mean the pointer should be pushed on the (forth) stack first,
or should it be the TOS so that the C interface passes it first to C?


If C would declare a function as (say)
    int something(*buf, int);
should I declare now
    libc something  ptr int (int) something
or as
    libc something  int ptr (int) something

Would that be
    something ( int ptr -- int )
or
    something ( ptr int -- int )
in Forth?


Simple things can appear so complicated sometimes...
Robert Epprecht

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to