Skip to content

Clipper2 Julia wrapper - #61

Draft
gpeairs wants to merge 7 commits into
JuliaGeometry:masterfrom
gpeairs:clipper2-julia-wrapper
Draft

Clipper2 Julia wrapper#61
gpeairs wants to merge 7 commits into
JuliaGeometry:masterfrom
gpeairs:clipper2-julia-wrapper

Conversation

@gpeairs

@gpeairs gpeairs commented Aug 3, 2026

Copy link
Copy Markdown

This is the companion to #60 adding the Julia side of the wrapper -- it would make sense to me to review/merge that one separately, but this is close to complete from my perspective and should help with evaluating the C wrapper.

The libcclipper2 product is being added to Clipper2_jll by JuliaPackaging/Yggdrasil#14270, which is gated on #60. Until that JLL is published, place a matching local library at deps/libcclipper2.so, deps/libcclipper2.dylib, or deps/libcclipper2.dll for local testing. It must be built from deps/cwrapper/cclipper2.cpp with -DUSINGZ against the patched Clipper2 2.0.1 used by that Yggdrasil recipe.

The package loader and Project.toml will use the Clipper2_jll.libcclipper2 product once it is available. CI will fail until then.

I've marked this as a draft for now, since it needs to wait until the above PRs are merged.

@gpeairs
gpeairs marked this pull request as draft August 3, 2026 13:08
@gpeairs gpeairs mentioned this pull request Aug 31, 2026
@SimonDanisch

Copy link
Copy Markdown
Member

Let an LLM try this pr out: built the wrapper against patched Clipper2 2.0.1 per Yggdrasil #14270 — 112/112 tests pass, docs clean. Fuzzed ~1000 boolean ops and stress-tested GC in the result callbacks; no issues.

One defect: Clipper64() / ClipperOffset() don't check the NULL return documented at cclipper2.h:79 (engine.jl:71, offset.jl:23), so a failed create segfaults on first use instead of throwing.

One question: the *_z entry points have no Julia surface: only runtests.jl reaches them via raw ccall. Should those be wrapped?

@gpeairs

gpeairs commented Sep 1, 2026

Copy link
Copy Markdown
Author

Thanks for trying it out!

One defect: Clipper64() / ClipperOffset() don't check the NULL return documented at cclipper2.h:79 (engine.jl:71, offset.jl:23), so a failed create segfaults on first use instead of throwing.

Right, fixed.

One question: the *_z entry points have no Julia surface: only runtests.jl reaches them via raw ccall. Should those be wrapped?

Yeah, they should. Added Z versions of the types, dispatch on Z paths for the add_...! methods, and execute_polytree_z.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants