---
name: "hal_set_constructor"
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_set_constructor"
---

# hal\_set\_constructor(3hal)

sets the constructor function for this component

## NAME

hal\_set\_constructor - sets the constructor function for this component

## SYNTAX

typedef int (\*hal\_constructor\_t)(const char \*prefix, const char \*arg); int hal\_set\_constructor(int *comp\_id*, hal\_constructor\_t *constructor*)

## ARGUMENTS

*comp\_id* A HAL component identifier returned by an earlier call to **hal\_init**.

*prefix* The prefix to be given to the pins, parameters, and functions in the new instance

*arg* An argument that may be used by the component to customize this instance.

## DESCRIPTION

As an experimental feature in HAL 2.1, components may be *constructable*. Such a component may create pins and parameters not only at the time the module is loaded, but it may create additional pins and parameters, and functions on demand.

## RETURN VALUE

Returns a HAL status code.

## SEE ALSO

**[halcmd(1)](/halcmd/1.md)**
