---
name: "memchanapi"
section: "3tcl"
platform: "linux"
package: "tcl-memchan-dev"
version: "2.3+dfsg-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/memchanapi"
---

# memchanapi(3tcl)

C API for creating memory channels

```

```

## NAME

memchan - C API for creating memory channels

## 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 provides a C API for use by third-party extension writers. This is exposed by a Tcl stubs library table to reduce version dependency as is available for Tcl itself.

## COMMAND

- 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 an returns a channel exactly as described in the Tcl command pages for each of the **memchan** commands. The Tcl commands internally call these functions to create the channels.

The **memchan** channel accepts an *initialSize* argument to permit pre-allocating space for the internal buffer. Normally this may be set to 0.

The **fifo2** API function looks a little different because it must return two linked channels.

## SEE ALSO

Tcl\_GetChannelName

## COPYRIGHT

```
Copyright (c) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
```
