+
Skip to content

Fork of libffi, Much Foreign Function.

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-BUILDTOOLS
Notifications You must be signed in to change notification settings

discere-os/libffi.wasm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@discere-os/libffi.wasm

WebAssembly port of libffi - Portable foreign function interface library providing a C interface to other programming languages.

CI/CD JSR npm version License Status

libffi.wasm - Enhanced Foreign Function Interface for WebAssembly

A comprehensive WebAssembly implementation of libffi v3.5.2 with TypeScript-first developer experience, SIMD optimizations, and WASM-native features.

Features

🏗️ Official libffi v3.5.2 Compatibility

  • Full API support - All standard libffi functions including Raw API, closures, and Go closures
  • WASM32/WASM64 - Automatic detection and support for both pointer sizes
  • Complex numbers - Complete support for complex float, double, and long double
  • Variadic functions - Full printf-style variadic function support

🚀 WASM-Native Enhancements

  • TypeScript-first API - Object-oriented interface with complete type safety
  • CDN dynamic loading - Load from wasm.discere.cloud with fallback support
  • SIMD bulk operations - 16-byte vector operations for performance-critical paths
  • ES6 module output - Modern JavaScript integration with proper exports

⚡ Performance Optimizations

  • 25M+ CIF preparations/sec - Optimized call interface setup
  • SIMD memory operations - Fast bulk clearing and copying for ≥16 byte operations
  • Memory pooling - Reduced allocation overhead for frequent operations
  • LTO + Closure Compiler - Maximum optimization with dead code elimination

Quick Start

Installation

npm install @discere-os/libffi.wasm

Basic Usage

import LibFFI, { FFIType } from '@discere-os/libffi.wasm'

const ffi = new LibFFI()
await ffi.initialize()

const intType = { size: 4, alignment: 4, type: FFIType.SINT32 }
const cif = ffi.prepareCall(intType, [intType, intType])

Testing

pnpm install
pnpm test      # Comprehensive vitest suite with real WASM
pnpm benchmark # Performance measurement

License

MIT License - Compatible with official libffi v3.5.2 licensing.

💖 Support This Work

This WebAssembly port is part of a larger effort to bring professional desktop applications to browsers with native performance.

👨‍💻 About the Maintainer: Isaac Johnston (@superstructor) - Building foundational browser-native computing infrastructure through systematic C/C++ to WebAssembly porting.

📊 Impact: 70+ open source WASM libraries enabling professional applications like Blender, GIMP, and scientific computing tools to run natively in browsers.

🚀 Your Support Enables:

  • Continued maintenance and updates
  • Performance optimizations
  • New library ports and integrations
  • Documentation and tutorials
  • Cross-browser compatibility testing

💖 Sponsor this work to help build the future of browser-native computing.

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • C 58.9%
  • Assembly 16.8%
  • Shell 16.1%
  • M4 3.0%
  • TypeScript 1.8%
  • JavaScript 1.2%
  • Other 2.2%
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载