> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arkffi.hmbill.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Library

> dlopen 返回的加载库实例

`Library` 类表示已加载的共享库。

## 示例

```typescript theme={null}
import { dlopen, FFIType } from 'arkffi';

const lib = dlopen('libffi_target.so', {
  add: { args: [FFIType.double, FFIType.double], returns: FFIType.double },
});
lib.symbols.add(2.0, 3.0);
lib.close();
```

## 属性

### `symbols`

```
readonly symbols: ConvertFns<Fns>;
```

键与 `defs` 参数中的函数名匹配的对象。每个值都是可调用的函数。

```typescript theme={null}
lib.symbols.add(2.0, 3.0);
lib.symbols.compute(0, 4.0, 'square');
```

## 方法

### `close()`

```typescript theme={null}
close(): void;
```

调用 `dlclose()` 释放原生库句柄。

```typescript theme={null}
lib.close();
lib.close();  // 多次调用安全
```
