From 3b88476130aa2fe1af7d089cd18a9abc72e23678 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Wed, 19 Jul 2017 18:49:19 +0700 Subject: Add a way to retrieve stack bottom of the main thread I'm working on Nim bindings and Nim GC needs to know the stack boundaries to check whether certain pointers are located on the stack or in the heap. This commit adds godot_get_stack_bottom procedure to gdnative module which returns pointer to the stack bottom of the main thread. Later on this may be improved to return stack bottom of the current thread. --- core/os/os.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'core/os/os.h') diff --git a/core/os/os.h b/core/os/os.h index 362fec8a9e..957c1d0ba7 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -60,6 +60,8 @@ class OS { char *last_error; + void *_stack_bottom; + public: enum RenderThreadMode { @@ -411,6 +413,13 @@ public: bool check_feature_support(const String &p_feature); + /** + * Returns the stack bottom of the main thread of the application. + * This may be of use when integrating languages with garbage collectors that + * need to check whether a pointer is on the stack. + */ + virtual void *get_stack_bottom() const; + bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); virtual ~OS(); -- cgit v1.2.3