This commit is contained in:
blueloveTH 2024-05-24 23:08:37 +08:00
parent 698566a8a7
commit 617ff4fc77
3 changed files with 3 additions and 7 deletions

View File

@ -38,10 +38,6 @@
#undef max #undef max
#endif #endif
/*******************************************************************************/
#if PK_ENABLE_STD_FUNCTION
#include <functional>
#endif
/*******************************************************************************/ /*******************************************************************************/
#if PK_ENABLE_THREAD #if PK_ENABLE_THREAD

View File

@ -23,11 +23,11 @@
#define PK_GC_MIN_THRESHOLD 16384 #define PK_GC_MIN_THRESHOLD 16384
#endif #endif
// Whether to use `std::function` to do bindings or not // Whether to use `pkpy::function<>` to do bindings or not
// By default, functions to be binded must be a C function pointer without capture // By default, functions to be binded must be a C function pointer without capture
// However, someone thinks it's not convenient. // However, someone thinks it's not convenient.
// By setting this to 1, capturing lambdas can be binded, // By setting this to 1, capturing lambdas can be binded,
// but it's slower and may cause severe "code bloat", also needs more time to compile. // but it's slower and may cause "code bloat", it also needs more time to compile.
#define PK_ENABLE_STD_FUNCTION 0 #define PK_ENABLE_STD_FUNCTION 0
/*************** debug settings ***************/ /*************** debug settings ***************/

View File

@ -7,7 +7,7 @@
namespace pkpy { namespace pkpy {
#if PK_ENABLE_STD_FUNCTION #if PK_ENABLE_STD_FUNCTION
using NativeFuncC = std::function<PyVar(VM*, ArgsView)>; using NativeFuncC = function<PyVar(VM*, ArgsView)>;
#else #else
typedef PyVar (*NativeFuncC)(VM*, ArgsView); typedef PyVar (*NativeFuncC)(VM*, ArgsView);
#endif #endif