haskell / haskell/c2hs

Preserving existing result with +

Open
#236 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
211
Forks
52
PR merge metrics
No merged PRs in 30d

Description

The `+` notation in `fun` hooks (for converting a function that manipulates a fresh pointer, to one that does the allocation itself and returns the pointer) is to my mind one of the nicest features of c2hs. Unfortunately, it discards the original return value, making it useless in the case where the C function returns something useful eg. an error code, and we want to return that result along with the pointer.

It would be amazing (and presumably not that difficult to implement, I may even look at submitting a PR) if we could specify that we would like a tuple returned, and have c2hs do the obvious conversions.

eg. ``{#fun cfunc as ^ {+} -> `(aPtr, b)' #}``
for `b cfunc (x *a)`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.