From 0d21c361d00d528e3fb678ae409899ff643ab853 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Tue, 28 Nov 2017 12:04:07 +0700 Subject: [PATCH] Use setStackBottom for methods called from outside --- godot.nimble | 2 +- godot/nim/godotmacros.nim | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/godot.nimble b/godot.nimble index cac30be..968dac3 100644 --- a/godot.nimble +++ b/godot.nimble @@ -1,4 +1,4 @@ -version = "0.6.8" +version = "0.6.9" author = "Xored Software, Inc." description = "Godot Engine bindings" license = "MIT" diff --git a/godot/nim/godotmacros.nim b/godot/nim/godotmacros.nim index ef478f9..682f8ec 100644 --- a/godot/nim/godotmacros.nim +++ b/godot/nim/godotmacros.nim @@ -541,10 +541,17 @@ proc genType(obj: ObjectDecl): NimNode {.compileTime.} = template registerGodotMethod(classNameLit, classNameIdent, methodNameIdent, methodNameLit, minArgs, maxArgs, argTypes, methFuncIdent, hasReturnValue) = + {.emit: """/*TYPESECTION*/ +N_NOINLINE(void, setStackBottom)(void* thestackbottom); +""".} proc methFuncIdent(obj: ptr GodotObject, methodData: pointer, userData: pointer, numArgs: cint, args: var array[MAX_ARG_COUNT, ptr GodotVariant]): GodotVariant {.noconv.} = + var stackBottom {.volatile.}: pointer + {.emit: """ + setStackBottom((void*)(&`stackBottom`)); + """.} let self = cast[classNameIdent](userData) const isStaticCall = methodNameLit == cstring"_ready" or methodNameLit == cstring"_process" or