LEFT | RIGHT |
(no file at all) | |
1 #include <emscripten.h> | 1 #include "runtime.h" |
2 | |
3 #include "../intrusive_ptr.h" | 2 #include "../intrusive_ptr.h" |
4 #include "../String.h" | 3 #include "../String.h" |
5 | 4 |
6 extern "C" | 5 extern "C" |
7 { | 6 { |
8 void EMSCRIPTEN_KEEPALIVE InitString(DependentString* str, | 7 void BINDINGS_EXPORTED InitString(DependentString* str, |
9 String::value_type* data, String::size_type len) | 8 String::value_type* data, String::size_type len) |
10 { | 9 { |
11 // String is already allocated on stack, we merely need to call | 10 // String is already allocated on stack, we merely need to call |
12 // constructor. | 11 // constructor. |
13 new (str) DependentString(data, len); | 12 new (str) DependentString(data, len); |
14 } | 13 } |
15 | 14 |
16 void EMSCRIPTEN_KEEPALIVE DestroyString(OwnedString* str) | 15 void BINDINGS_EXPORTED DestroyString(OwnedString* str) |
17 { | 16 { |
18 // Stack memory will be freed automatically, we need to call | 17 // Stack memory will be freed automatically, we need to call |
19 // destructor explicitly however. | 18 // destructor explicitly however. |
20 str->~OwnedString(); | 19 str->~OwnedString(); |
21 } | 20 } |
22 | 21 |
23 String::size_type EMSCRIPTEN_KEEPALIVE GetStringLength( | 22 String::size_type BINDINGS_EXPORTED GetStringLength( |
24 const String& str) | 23 const String& str) |
25 { | 24 { |
26 return str.length(); | 25 return str.length(); |
27 } | 26 } |
28 | 27 |
29 const String::value_type* EMSCRIPTEN_KEEPALIVE GetStringData( | 28 const String::value_type* BINDINGS_EXPORTED GetStringData( |
30 const String& str) | 29 const String& str) |
31 { | 30 { |
32 return str.data(); | 31 return str.data(); |
33 } | 32 } |
34 | 33 |
35 void EMSCRIPTEN_KEEPALIVE ReleaseRef(ref_counted* ptr) | 34 void BINDINGS_EXPORTED ReleaseRef(ref_counted* ptr) |
36 { | 35 { |
37 ptr->ReleaseRef(); | 36 ptr->ReleaseRef(); |
38 } | 37 } |
39 } | 38 } |
LEFT | RIGHT |