Robert Epprecht wrote:
> 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 you want top open a file "/dev/midi", you call open like this:

s\" /dev/midi\0" drop  O_RDONLY O_NONBLOCK or  $1B6 open

The $1B6 is octal 666 (we don't have an octal prefix IIRC), and is
irrelevant here (where you don't create a file).  As for the
O_... constants, at the moment you have to extract them manually from
the C header files.

> If C would declare a function as (say)
>     int something(*buf, int);

That's not C, but I'll assume you mean something like

int something(char *, int);

> should I declare now
>     libc something  ptr int (int) something

Yes.

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

Yes, this one.

> Simple things can appear so complicated sometimes...

It seems that Bernd sometimes confuses the order because it is
different between bigForth and Gforth; if you ignore the results of
this confusion, the ordering is pretty straightforward: It is the same
for the C declaration, C call, declaration in Gforth, and call from
Gforth.

- anton

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

Reply via email to