Kaynağa Gözat

set `PK_ENABLE_OS` to 0 by default

blueloveTH 2 yıl önce
ebeveyn
işleme
5ce5285d4b
3 değiştirilmiş dosya ile 6 ekleme ve 4 silme
  1. 3 3
      docs/quick-start/config.md
  2. 1 1
      include/pocketpy/config.h
  3. 2 0
      src/io.cpp

+ 3 - 3
docs/quick-start/config.md

@@ -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>
 ```
 

+ 1 - 1
include/pocketpy/config.h

@@ -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)

+ 2 - 0
src/io.cpp

@@ -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){