---
name: "hal_link"
section: "3hal"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/hal_signal_new"
---

# hal\_link(3hal)

Manipulate HAL signals

Part of [hal\_signal\_new(3hal)](/hal_signal_new/3hal.md).

## NAME

hal\_signal\_new, hal\_signal\_delete, hal\_link, hal\_unlink - Manipulate HAL signals

## SYNTAX

int hal\_signal\_new(const char \**signal\_name*, hal\_type\_t *type*)

int hal\_signal\_delete(const char \**signal\_name*)

int hal\_link(const char \**pin\_name*, const char \**signal\_name*)

int hal\_unlink(const char \**pin\_name*)

## ARGUMENTS

- *signal\_name*

  The name of the signal

- *pin\_name*

  The name of the pin

- *type*

  The type of the signal, as specified in **[hal\_type\_t(3hal)](/hal_type_t/3hal.md)**.

## DESCRIPTION

**hal\_signal\_new** creates a new signal object.  Once a signal has been created, pins can be linked to it with **hal\_link**.  The signal object contains the actual storage for the signal data.  Pin objects linked to the signal have pointers that point to the data.  'name' is the name of the new signal.  It may be no longer than HAL\_NAME\_LEN characters.  If there is already a signal with the same name the call will fail.

**hal\_link** links a pin to a signal.  If the pin is already linked to the desired signal, the command succeeds.  If the pin is already linked to some other signal, it is an error.  In either case, the existing connection is not modified.  (Use 'hal\_unlink' to break an existing connection.)  If the signal already has other pins linked to it, they are unaffected - one signal can be linked to many pins, but a pin can be linked to only one signal.

**hal\_unlink** unlinks any signal from the specified pin.

**hal\_signal\_delete** deletes a signal object.  Any pins linked to the object are unlinked.

## RETURN VALUE

Returns a HAL status code.

## SEE ALSO

**[hal\_type\_t(3hal)](/hal_type_t/3hal.md)**
