Socket
Book a DemoInstallSign in
Socket

koffi

Package Overview
Dependencies
Maintainers
1
Versions
239
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koffi - npm Package Compare versions

Comparing version

to
2.7.1

5

CHANGELOG.md

@@ -7,2 +7,7 @@ # Changelog

#### Koffi 2.7.1 (2024-01-02)
- Support C-like `int[3]` syntax for [fixed array types](input.md#fixed-size-c-arrays)
- Refuse type specifiers with invalid tokens at the end (previously ignored)
#### Koffi 2.7.0 (2023-12-21)

@@ -9,0 +14,0 @@

2

doc/functions.md

@@ -12,3 +12,3 @@ # Function calls

const lib = koffi.load('/path/to/shared/library'); // File extension depends on platforms: .so, .dll, .dylib, etc.
````
```

@@ -15,0 +15,0 @@ This library will be automatically unloaded once all references to it are gone (including all the functions that use it, as described below).

@@ -339,2 +339,4 @@ # Input parameters

*Changed in Koffi 2.7.1*
Fixed-size arrays are declared with `koffi.array(type, length)`. Just like in C, they cannot be passed as functions parameters (they degenerate to pointers), or returned by value. You can however embed them in struct types.

@@ -354,9 +356,9 @@

// Those two structs are exactly the same, only the array conversion hint is different
const Foo1 = koffi.struct('Foo', {
const Foo1 = koffi.struct('Foo1', {
i: 'int',
a16: koffi.array('int16_t', 8)
a16: koffi.array('int16_t', 2)
});
const Foo2 = koffi.struct('Foo', {
const Foo2 = koffi.struct('Foo2', {
i: 'int',
a16: koffi.array('int16_t', 8, 'Array')
a16: koffi.array('int16_t', 2, 'Array')
});

@@ -372,2 +374,15 @@

You can also declare arrays with the C-like short syntax in type declarations, as shown below:
```js
const StructType = koffi.struct('StructType', {
f8: 'float [8]',
self4: 'StructType *[4]'
});
```
```{note}
The short C-like syntax was introduced in Koffi 2.7.1, use `koffi.array()` for older versions.
```
### Fixed-size string buffers

@@ -374,0 +389,0 @@

@@ -107,4 +107,4 @@ // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>

export function pointer(ref: TypeSpec): IKoffiCType;
export function pointer(ref: TypeSpec, asteriskCount: number): IKoffiCType;
export function pointer(name: string, ref: TypeSpec, asteriskCount: number): IKoffiCType;
export function pointer(ref: TypeSpec, asteriskCount?: number): IKoffiCType;
export function pointer(name: string, ref: TypeSpec, asteriskCount?: number): IKoffiCType;

@@ -135,2 +135,3 @@ export function out(type: TypeSpec): IKoffiCType;

export function address(value: any): bigint;
export function call(value: any, type: TypeSpec, ...args: any[]): any;
export function encode(ref: any, type: TypeSpec): void;

@@ -137,0 +138,0 @@ export function encode(ref: any, type: TypeSpec, value: any): void;

@@ -381,4 +381,4 @@ "use strict";

name: "koffi",
version: "2.7.0",
stable: "2.7.0",
version: "2.7.1",
stable: "2.7.1",
description: "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -385,0 +385,0 @@ keywords: [

@@ -381,4 +381,4 @@ "use strict";

name: "koffi",
version: "2.7.0",
stable: "2.7.0",
version: "2.7.1",
stable: "2.7.1",
description: "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -385,0 +385,0 @@ keywords: [

{
"name": "koffi",
"version": "2.7.0",
"stable": "2.7.0",
"version": "2.7.1",
"stable": "2.7.1",
"description": "Fast and simple C FFI (foreign function interface) for Node.js",

@@ -6,0 +6,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.