emscripten-core / emscripten-core/emscripten

References to C++ built-in datatypes with Embind?

Open
#13,338 3 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I am trying to create bindings to a C++ function with the following signature using Embind:
```cpp
void BRepTools::UVBounds(float& UMin, float& UMax, float& VMin, float& VMax)
```

This function is part of a third-party library and I would like to avoid modifying it. The function "returns" the 4 values by changing the values of the reference arguments.

As JavaScript does not have a concept of reference types (arguments are passed as shallow copies), I understand that this will not work out of the box.

Is there a workaround for this using Embind? Otherwise, my only idea would be to change the C++ function (or to implement an additional function) to return these values.

See the original issue [here](https://github.com/donalffons/opencascade.js/issues/21).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.