emscripten-core / emscripten-core/emscripten

Question: How to expose a static pointer property

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

Description

Hello,

I have a class which contains a static pointer property that I would like to expose to my JavaScript code, however I cannot seem to find a way of doing this. Exposing the property without marking it with `allow_raw_pointers()` doesn't work (as expected) but marking a `class_property` in Embind with `allow_raw_pointers()` seems impossible too.
I would like to do something like this:
```lang-c
class Test {
public:
static int* number;
};

EMSCRIPTEN_BINDINGS(test) {
class_("Test")
.class_property("number", &Test::number, allow_raw_pointers());
}
```
How can I expose such a property in Embind?

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.