[Top][All Lists]

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

Re: C library

From: Bernd Paysan
Subject: Re: C library
Date: Fri, 29 Sep 2023 04:17:28 +0200

Am Donnerstag, 28. September 2023, 20:00:34 CEST schrieb Mario Beaulieu via 
Gforth discussion and announcements:
> c-function mosquitto_new   mosquittoNew a n void -- "What do I put here?"

This should be:

c-function mosquittoNew mosquitto_new s n a -- a

The order of names (Forth name first, C name second) matters, and for the 
paramenters: whatever address it is, it should be an a type, i.e. whenever the 
C programmer writes a * at the end of the type, it is an a.  Unless of course 
if it is a const char *, i.e. a string, then it is more comfortable to pass a 
Forth string to C, and use the s type, so you can call

s" my id" 1 callback-object mosquittoNew

and the s type constructs a zero terminated C string out of that Forth string.

Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]