@obinexusltd/fsharp-polycall
v1.0.0
Published
F#/.NET P/Invoke source binding for libpolycall 1.5
Maintainers
Readme
@obinexusltd/fsharp-polycall
F#/.NET P/Invoke binding for libpolycall 1.5. The adapter maps F# calls to the single core entry point:
polycall_ffi_run_config(config_path, 1)Configuration parsing, validation, networking, and runtime policy remain in libpolycall. This project only marshals a UTF-8 configuration path and returns the core status unchanged.
Install the source package
npm install @obinexusltd/fsharp-polycallThe npm package publishes the complete F#, P/Invoke, and C source tree. It is a
native source distribution rather than a JavaScript implementation. Calling
require('@obinexusltd/fsharp-polycall') returns absolute paths to the packaged
project, sources, headers, configuration, manifest, and Makefile.
Requirements
- libpolycall 1.5 development library and headers
- .NET 8 SDK with F# support
- a C11 compiler and GNU Make
Build
Build the standalone adapter archive without linking libpolycall:
makeBuild the F# assembly:
dotnet build src/FSharpPolycall/FSharpPolycall.fsproj --configuration Release
# or
npm run build:dotnetBuild the native P/Invoke library by supplying the linker flags for libpolycall:
export POLYCALL_LDFLAGS='-L/path/to/lib -lpolycall'
make nativePowerShell uses the same variable:
$env:POLYCALL_LDFLAGS = '-LC:\path\to\lib -lpolycall'
make nativePlace fsharp_polycall.dll, libfsharp_polycall.so, or
libfsharp_polycall.dylib in a native-library search directory before running
the F# assembly. .NET resolves the extension and Unix lib prefix from the
P/Invoke name automatically.
API
open OBINexus.Polycall
let status = Polycall.runConfig "fsharp-polycallrc"
let result = Polycall.tryRunConfig "fsharp-polycallrc"
Polycall.runConfigOrRaise "fsharp-polycallrc"runConfigreturns the exact libpolycall status.tryRunConfigproducesOk ()orError status.runConfigOrRaiseraisesPolycallExceptionfor a non-zero status.runDefaultandrunDefaultOrRaiseusefsharp-polycallrc.
See examples/Program.fs for a runnable example.
Verification
The default suite needs only a C compiler, Make, Node.js, and PowerShell on Windows:
npm testIt verifies exact path forwarding, the required validation flag, status propagation, thin-adapter constraints, and npm package completeness.
With the .NET 8 SDK installed, run the end-to-end F#/PInvoke smoke test:
npm run test:fsharpPackage layout
src/FSharpPolycall/— public F# API and .NET projectc_src/— native adapter exported for P/Invokeinclude/— adapter C headergenerated/polycall/— minimal generated core FFI declarationexamples/— runnable F# example and sample configurationtests/— native mock, F# smoke project, and npm package test
Author and license
Copyright © 2026 Nnamdi Michael Okpala [email protected].
Released under the MIT License.
