Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/embind/test_negative_constants.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 <emscripten/bind.h>
7
#include <emscripten/emscripten.h>
8
9
#define NEGATIVE_FLOAT_NUM -3.1416
10
#define NEGATIVE_INT_NUM -10
11
const float negative_float_num = -3.1416;
12
const double negative_double_num = -2.7182818;
13
const int negative_int_num = -10;
14
15
EMSCRIPTEN_BINDINGS(constants) {
16
emscripten::constant("NEGATIVE_FLOAT_NUM", NEGATIVE_FLOAT_NUM);
17
emscripten::constant("NEGATIVE_INT_NUM", NEGATIVE_INT_NUM);
18
emscripten::constant("negative_float_num", negative_float_num);
19
emscripten::constant("negative_double_num", negative_double_num);
20
emscripten::constant("negative_int_num", negative_int_num);
21
}
22
23
int main() {
24
EM_ASM(
25
out("NEGATIVE_FLOAT_NUM = " + Module['NEGATIVE_FLOAT_NUM']);
26
out("NEGATIVE_INT_NUM = " + Module['NEGATIVE_INT_NUM']);
27
out("negative_float_num = " + Module['negative_float_num']);
28
out("negative_double_num = " + Module['negative_double_num']);
29
out("negative_int_num = " + Module['negative_int_num']);
30
);
31
}
32
33