OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #ifndef SRC_VM_FFI_H_ | 5 #ifndef SRC_VM_FFI_H_ |
6 #define SRC_VM_FFI_H_ | 6 #define SRC_VM_FFI_H_ |
7 | 7 |
8 #include "src/shared/globals.h" | 8 #include "src/shared/globals.h" |
9 #include "src/shared/natives.h" | 9 #include "src/shared/natives.h" |
10 | 10 |
11 namespace fletch { | 11 namespace dartino { |
12 | 12 |
13 class DefaultLibraryEntry; | 13 class DefaultLibraryEntry; |
14 class Mutex; | 14 class Mutex; |
15 | 15 |
16 class ForeignFunctionInterface { | 16 class ForeignFunctionInterface { |
17 public: | 17 public: |
18 static void Setup(); | 18 static void Setup(); |
19 static void TearDown(); | 19 static void TearDown(); |
20 static bool AddDefaultSharedLibrary(const char* library); | 20 static bool AddDefaultSharedLibrary(const char* library); |
21 static void* LookupInDefaultLibraries(const char* symbol); | 21 static void* LookupInDefaultLibraries(const char* symbol); |
22 | 22 |
23 private: | 23 private: |
24 static DefaultLibraryEntry* libraries_; | 24 static DefaultLibraryEntry* libraries_; |
25 static Mutex* mutex_; | 25 static Mutex* mutex_; |
26 }; | 26 }; |
27 | 27 |
28 #ifdef FLETCH_ENABLE_FFI | 28 #ifdef DARTINO_ENABLE_FFI |
29 // Platform specific ffi constants and methods. | 29 // Platform specific ffi constants and methods. |
30 class ForeignUtils { | 30 class ForeignUtils { |
31 public: | 31 public: |
32 // We construct default bundle library paths from a prefix and a postfix. | 32 // We construct default bundle library paths from a prefix and a postfix. |
33 static const char* kLibBundlePrefix; | 33 static const char* kLibBundlePrefix; |
34 static const char* kLibBundlePostfix; | 34 static const char* kLibBundlePostfix; |
35 | 35 |
36 // In preparation of supporting windows we have a function for this. | 36 // In preparation of supporting windows we have a function for this. |
37 // [buffer] may be modified by DirectoryName. In particular, the result of | 37 // [buffer] may be modified by DirectoryName. In particular, the result of |
38 // DirectoryName may use [buffer] for storage but is not necessarily | 38 // DirectoryName may use [buffer] for storage but is not necessarily |
39 // identical to [buffer]. | 39 // identical to [buffer]. |
40 // [len] is the size of [buffer], typically MAXPATHLEN + 1. | 40 // [len] is the size of [buffer], typically MAXPATHLEN + 1. |
41 static char* DirectoryName(char* path, char* buffer, size_t len); | 41 static char* DirectoryName(char* path, char* buffer, size_t len); |
42 }; | 42 }; |
43 | 43 |
44 #endif // FLETCH_ENABLE_FFI | 44 #endif // DARTINO_ENABLE_FFI |
45 | 45 |
46 } // namespace fletch | 46 } // namespace dartino |
47 | 47 |
48 #endif // SRC_VM_FFI_H_ | 48 #endif // SRC_VM_FFI_H_ |
OLD | NEW |