pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

[FFI] Add handle to pointer functions #333

Closed JP-Ellis closed 7 months ago

JP-Ellis commented 8 months ago

Handles have been introduced as a way to avoid passing pointers directly, specifically for languages which don't support pointers nicely. The FFI currently has a mix of functions which require a pointer or handles.

Unfortunately, a number of FFI functions still require a pointer, and do not have a handle equivalent. As one example of the discrepancy:

There's unfortunately no way at present to obtain the pointer of the Pact behind a specific Pact handle.

rholshausen commented 7 months ago

Currently, both the Pact handle and Pact pointer own their content. We can add a function to return a Pact pointer from a Pact handle, but it will be clone of the contents.

rholshausen commented 7 months ago

I've added two functions: