Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/embind/test_dynamic_initialization.cpp
4150 views
1
// Copyright 2018 The Emscripten Authors. All rights reserved.
2
// Emscripten is available under two separate licenses, the MIT license and the
3
// University of Illinois/NCSA Open Source License. Both these licenses can be
4
// found in the LICENSE file.
5
6
#include <string>
7
#include <emscripten/bind.h>
8
#include <emscripten/emscripten.h>
9
10
const std::string global_string = "global string";
11
12
EMSCRIPTEN_BINDINGS(constants) {
13
emscripten::constant("global_string", global_string);
14
}
15
16
int main() {
17
EM_ASM(
18
console.log("global_string = " + Module['global_string']);
19
);
20
}
21
22