SPI\_connect

|       SPI\_connect       |                        |                         |                  |                            |
|:------------------------:|------------------------|-------------------------|------------------|----------------------------|
|[Prev](spi-interface.html)|[Up](spi-interface.html)|47.1. Interface Functions|[Home](index.html)| [Next](spi-spi-finish.html)|

---

[]()[]()

## SPI\_connect

SPI\_connect, SPI\_connect\_ext — connect a C function to the SPI manager

## Synopsis

```
int SPI_connect(void)

```

```
int SPI_connect_ext(int options)

```

## Description

`SPI_connect` opens a connection from a C function invocation to the SPI manager. You must call this function if you want to execute commands through SPI. Some utility SPI functions can be called from unconnected C functions.

`SPI_connect_ext` does the same but has an argument that allows passing option flags. Currently, the following option values are available:

`SPI_OPT_NONATOMIC`

 Sets the SPI connection to be *nonatomic*, which means that transaction control calls `SPI_commit`, `SPI_rollback`, and `SPI_start_transaction` are allowed. Otherwise, calling these functions will result in an immediate error.

`SPI_connect()` is equivalent to `SPI_connect_ext(0)`.

## Return Value

`SPI_OK_CONNECT`

 on success

`SPI_ERROR_CONNECT`

 on error

---

|[Prev](spi-interface.html)|[Up](spi-interface.html)| [Next](spi-spi-finish.html)|
|:-------------------------|:----------------------:|---------------------------:|
|47.1. Interface Functions |   [Home](index.html)   |         SPI\_finish        |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>