memchan(3tcl)
π memchan β the C API edition (it's memchan(3tcl) bestie, section 3, C library, let's GO)
okay so if you're a C extension author and you want in on the memory-channel magic, this is your page. no cap. π¦
β¨ SYNOPSIS β¨
package require Tcl
package require memchan
Tcl_Channel Memchan_CreateMemoryChannel (Tcl_Interp *interp, int
initialSize)
Tcl_Channel Memchan_CreateFifoChannel (Tcl_Interp *interp)
void Memchan_CreateFifo2Channel (Tcl_Interp *interp, Tcl_Channel *aPtr,
Tcl_Channel *bPtr)
Tcl_Channel Memchan_CreateNullChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateZeroChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateRandomChannel (Tcl_Interp *interp)
πΈ DESCRIPTION πΈ
The memchan package ships a whole C API for third-party extension writers to use, because she's generous like that π
. It's exposed by a Tcl stubs library table β which is the same move Tcl itself makes β specifically so that version dependency stays low. Obsessed. β¨
π COMMAND π
the whole lineup, one by one, no skips:
Tcl_Channel Memchan_CreateMemoryChannel (Tcl_Interp *interp, int
initialSize)
Tcl_Channel Memchan_CreateFifoChannel (Tcl_Interp *interp)
void Memchan_CreateFifo2Channel (Tcl_Interp *interp, Tcl_Channel *aPtr,
Tcl_Channel *bPtr)
Tcl_Channel Memchan_CreateNullChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateZeroChannel (Tcl_Interp *interp)
Tcl_Channel Memchan_CreateRandomChannel (Tcl_Interp *interp)
Each of these functions creates and returns a channel exactly as described in the Tcl command pages for each of the memchan commands, fr fr. And plot twist β the Tcl commands are lowkey just calling these functions internally to make their channels. main character energy from the C side tbh. π
The memchan channel accepts an initialSize argument so you can pre-allocate space for the internal buffer if you want to be fancy. Normally you can just set it to 0 and vibe. π«Ά
The fifo2 API function looks a little different because β and this is the whole reason β it must return two linked channels. two of them. a matched set. π
π SEE ALSO π
Tcl_GetChannelName
π COPYRIGHT π
Copyright (c) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
and that's the page bestie, thanks for coming to my ted talk π§ β this was Memory channels, version 2.2, stamped memchan(3tcl), mwah π
π¦ where this page comes from
- debian trixie: tcl-memchan-dev 2.3+dfsg-2
- ubuntu questing: tcl-memchan-dev 2.3+dfsg-2
- ubuntu resolute: tcl-memchan-dev 2.3+dfsg-2build1
- ubuntu stonking: tcl-memchan-dev 2.3+dfsg-5
- Copyright (c) 2004 Pat Thoyts <patthoyts@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms