@obinexusltd/pascal-polycall
v1.0.0
Published
Free Pascal source binding for libpolycall 1.5
Downloads
75
Maintainers
Readme
@obinexusltd/pascal-polycall
Free Pascal source binding for libpolycall 1.5.
The package is a thin adapter. PascalPolycall.pas converts a Pascal
UTF8String to a stable PAnsiChar, and the native shim makes exactly one
call to polycall_ffi_run_config(config_path, 1). Configuration parsing,
validation, and runtime behavior remain in libpolycall.
Install
npm install @obinexusltd/pascal-polycallThis is a native source package. The npm tarball contains the Pascal and C sources, public and generated headers, examples, tests, scripts, Makefile, manifest, configuration, and license—not platform-specific binaries.
Pascal API
program Service;
{$mode objfpc}{$H+}
uses
PascalPolycall;
var
Status: LongInt;
begin
Status := PolycallRunConfig('pascal-polycallrc');
if Status <> 0 then
Halt(Status);
end.For exception-oriented startup code:
try
PolycallRunConfigOrRaise('pascal-polycallrc');
except
on Error: EPolycallError do
WriteLn('libpolycall status: ', Error.Status);
end;PolycallRunConfigreturns the libpolycall status unchanged.PolycallRunConfigOrRaiseraisesEPolycallErrorfor nonzero statuses.- Omitting the path uses
pascal-polycallrc. - Paths cross the C boundary as NUL-terminated UTF-8 strings.
Build and test
Build the native adapter archive and run all available checks:
npm run build
npm testThe current machine has GCC and GNU Make but does not have Free Pascal (fpc)
installed. npm test therefore runs the native mock contract test, boundary
audit, and npm package tests, while reporting the Pascal smoke test as skipped.
When fpc is on PATH, that smoke test runs automatically.
You can invoke the Pascal-specific operations directly:
npm run build:pascal
npm run test:pascalThe native test proves that paths are forwarded unchanged, validation mode is
always 1, and success/failure statuses are not rewritten. The Pascal test
exercises default and explicit paths plus EPolycallError through the actual
Pascal/C link boundary.
Link with libpolycall
Build libpolycall first, then make its library and this package's adapter archive visible to the Free Pascal linker. A typical GNU-compatible command is:
fpc -Mobjfpc `
-Fu./src `
-Fl./lib `
-FlC:/path/to/libpolycall/lib `
-k-lpascal_polycall `
-k-lpolycall `
examples/basic.pasRun npm run build first so lib/libpascal_polycall.a exists. Adjust library
paths and names for the selected libpolycall build and platform.
JavaScript build-tool entry point
The CommonJS entry point indexes every published project directory:
const binding = require('@obinexusltd/pascal-polycall');
console.log(binding.pascalUnit);
console.log(binding.directories.src.relativeFiles);
console.log(binding.resolve('examples', 'basic.pas'));Indexed relative directories are src, include, generated, dist,
examples, tests, and scripts. resolve() prevents traversal outside the
selected directory.
Publish
npm pack --dry-run
npm publish --access publicPublishing is never performed automatically.
License
MIT © 2026 Nnamdi Michael Okpala ([email protected]).
