aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/include/emscripten/val.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h
index 1fccd434..42d8d375 100644
--- a/system/include/emscripten/val.h
+++ b/system/include/emscripten/val.h
@@ -8,6 +8,8 @@ namespace emscripten {
namespace internal {
// Implemented in JavaScript. Don't call these directly.
extern "C" {
+ void _emval_register_symbol(const char*);
+
typedef struct _EM_VAL* EM_VAL;
void _emval_incref(EM_VAL value);
@@ -54,6 +56,25 @@ namespace emscripten {
}
}
+ class symbol {
+ public:
+ symbol() = delete;
+
+ // I so wish I could require the argument to be a string literal
+ symbol(const char* address)
+ : address(address)
+ {
+ internal::_emval_register_symbol(address);
+ }
+
+ operator const char*() const {
+ return address;
+ }
+
+ private:
+ const char* address;
+ };
+
class val {
public:
// missing operators: