set PK_ENABLE_OS to 0 by default

This commit is contained in:
blueloveTH 2024-01-20 22:57:35 +08:00
parent 74ffb3f6ed
commit 5ce5285d4b
3 changed files with 6 additions and 4 deletions

View File

@ -4,12 +4,12 @@ label: 'Advanced config'
order: -2
---
### Disable os-related features
### Enable os-related features
If you want to disable os-related features, you can do this before including `pocketpy.h`.
If you want to enable os-related features, you can do this before including `pocketpy.h`.
```cpp
#define PK_ENABLE_OS 0
#define PK_ENABLE_OS 1
#include <pocketpy.h>
```

View File

@ -10,7 +10,7 @@
// Whether to compile os-related modules or not
#ifndef PK_ENABLE_OS // can be overrided by cmake
#define PK_ENABLE_OS 1
#define PK_ENABLE_OS 0
#endif
// Enable this if you are working with multi-threading (experimental)

View File

@ -2,6 +2,7 @@
namespace pkpy{
#if PK_ENABLE_OS
static FILE* io_fopen(const char* name, const char* mode){
#if _MSC_VER
FILE* fp;
@ -20,6 +21,7 @@ static size_t io_fread(void* buffer, size_t size, size_t count, FILE* fp){
return fread(buffer, size, count, fp);
#endif
}
#endif
unsigned char* _default_import_handler(const char* name_p, int name_size, int* out_size){