فهرست منبع

refactor: core添加dllimport标志

SongZihuan 3 سال پیش
والد
کامیت
a3792db8ae
5فایلهای تغییر یافته به همراه46 افزوده شده و 46 حذف شده
  1. 9 9
      cmake/aFunHeader.cmake
  2. 16 16
      include/core/code.hpp
  3. 6 6
      include/core/env-var.hpp
  4. 5 5
      include/core/init.hpp
  5. 10 10
      include/core/msg.hpp

+ 9 - 9
cmake/aFunHeader.cmake

@@ -5,26 +5,26 @@ generate_export_header(tool-shared
                        EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/aFunToolExport.h"  # 导出的位置
                        EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/aFunToolExport.h"  # 导出的位置
                        BASE_NAME "AFUN_TOOL")
                        BASE_NAME "AFUN_TOOL")
 
 
-#generate_export_header(core-shared
-#                       EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/aFunCoreExport.h"  # 导出的位置
-#                       BASE_NAME "AFUN_CORE")
-#
+generate_export_header(core-shared
+                       EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/aFunCoreExport.h"  # 导出的位置
+                       BASE_NAME "AFUN_CORE")
+
 #generate_export_header(rt-shared
 #generate_export_header(rt-shared
 #                       EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/aFunlangExport.h"  # 导出的位置
 #                       EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/aFunlangExport.h"  # 导出的位置
 #                       BASE_NAME "AFUN_LANG")
 #                       BASE_NAME "AFUN_LANG")
 
 
 target_compile_definitions(tool-static PUBLIC AFUN_TOOL_STATIC_DEFINE=1)  # 静态库需要定义 AFUN_TOOL_STATIC_DEFINE
 target_compile_definitions(tool-static PUBLIC AFUN_TOOL_STATIC_DEFINE=1)  # 静态库需要定义 AFUN_TOOL_STATIC_DEFINE
-#target_compile_definitions(core-static PUBLIC AFUN_CORE_STATIC_DEFINE=1)
+target_compile_definitions(core-static PUBLIC AFUN_CORE_STATIC_DEFINE=1)
 #target_compile_definitions(rt-static PUBLIC AFUN_LANG_STATIC_DEFINE=1)
 #target_compile_definitions(rt-static PUBLIC AFUN_LANG_STATIC_DEFINE=1)
 #
 #
-set_property(TARGET tool-shared
+set_property(TARGET tool-shared core-shared
              PROPERTY C_VISIBILITY_PRESET "hidden")
              PROPERTY C_VISIBILITY_PRESET "hidden")
-set_property(TARGET tool-shared
+set_property(TARGET tool-shared core-shared
              PROPERTY VISIBILITY_INLINES_HIDDEN TRUE)
              PROPERTY VISIBILITY_INLINES_HIDDEN TRUE)
 
 
-set_property(TARGET tool-static
+set_property(TARGET tool-static core-static
              PROPERTY C_VISIBILITY_PRESET "default")
              PROPERTY C_VISIBILITY_PRESET "default")
-set_property(TARGET tool-static
+set_property(TARGET tool-static core-static
              PROPERTY VISIBILITY_INLINES_HIDDEN FALSE)
              PROPERTY VISIBILITY_INLINES_HIDDEN FALSE)
 
 
 #set_property(TARGET tool-shared core-shared rt-shared
 #set_property(TARGET tool-shared core-shared rt-shared

+ 16 - 16
include/core/code.hpp

@@ -37,23 +37,23 @@ namespace aFuncore {
         aFuntool::FileLine line;
         aFuntool::FileLine line;
         aFuntool::FilePath file;
         aFuntool::FilePath file;
     public:
     public:
-        explicit Code(FileLine line, ConstFilePath file="");
-        Code (const std::string &element, aFuntool::FileLine line, aFuntool::ConstFilePath file="", char prefix=NUL);
-        Code (BlockType block_type, Code *son, aFuntool::FileLine line, aFuntool::ConstFilePath file="", char prefix=NUL);
-        ~Code();
+        AFUN_CORE_EXPORT explicit Code(FileLine line, ConstFilePath file="");
+        AFUN_CORE_EXPORT Code (const std::string &element, aFuntool::FileLine line, aFuntool::ConstFilePath file="", char prefix=NUL);
+        AFUN_CORE_EXPORT Code (BlockType block_type, Code *son, aFuntool::FileLine line, aFuntool::ConstFilePath file="", char prefix=NUL);
+        AFUN_CORE_EXPORT ~Code();
 
 
-        Code *connect(Code *code);
-        void destructAll();
-        void display() const;
-        void displayAll() const;
-        bool write_v1(FILE *f, bool debug=false) const;
-        bool writeAll_v1(FILE *f, bool debug=false) const;
-        Code *read_v1(FILE *f, bool debug=false, int8_t read_type=code_element, bool to_son=false);
-        bool readAll_v1(FILE *f, bool debug=false);
-        [[nodiscard]] std::string getMD5_v1() const;
-        [[nodiscard]] std::string getMD5All_v1() const;
-        bool writeByteCode(ConstFilePath file_path, bool debug=false) const;  // NOLINT 允许忽略返回值
-        bool readByteCode(ConstFilePath file_path);
+        AFUN_CORE_EXPORT Code *connect(Code *code);
+        AFUN_CORE_EXPORT void destructAll();
+        AFUN_CORE_EXPORT void display() const;
+        AFUN_CORE_EXPORT void displayAll() const;
+        AFUN_CORE_EXPORT bool write_v1(FILE *f, bool debug=false) const;
+        AFUN_CORE_EXPORT bool writeAll_v1(FILE *f, bool debug=false) const;
+        AFUN_CORE_EXPORT Code *read_v1(FILE *f, bool debug=false, int8_t read_type=code_element, bool to_son=false);
+        AFUN_CORE_EXPORT bool readAll_v1(FILE *f, bool debug=false);
+        [[nodiscard]] AFUN_CORE_EXPORT std::string getMD5_v1() const;
+        [[nodiscard]] AFUN_CORE_EXPORT std::string getMD5All_v1() const;
+        AFUN_CORE_EXPORT bool writeByteCode(ConstFilePath file_path, bool debug=false) const;  // NOLINT 允许忽略返回值
+        AFUN_CORE_EXPORT bool readByteCode(ConstFilePath file_path);
 
 
         [[nodiscard]] CodeType getType() const {return type;}
         [[nodiscard]] CodeType getType() const {return type;}
         [[nodiscard]] char getPrefix() const {return prefix;}
         [[nodiscard]] char getPrefix() const {return prefix;}

+ 6 - 6
include/core/env-var.hpp

@@ -20,16 +20,16 @@ namespace aFuncore {
         pthread_rwlock_t lock;
         pthread_rwlock_t lock;
 
 
     public:
     public:
-        EnvVarSpace();
-        ~EnvVarSpace();
+        AFUN_CORE_EXPORT EnvVarSpace();
+        AFUN_CORE_EXPORT ~EnvVarSpace();
 
 
         [[nodiscard]] size_t getCount() const {return count;}
         [[nodiscard]] size_t getCount() const {return count;}
 
 
-        bool findString(const std::string &name, std::string &str) const;
-        bool findNumber(const std::string &name, int32_t &num) const;
+        AFUN_CORE_EXPORT bool findString(const std::string &name, std::string &str) const;
+        AFUN_CORE_EXPORT bool findNumber(const std::string &name, int32_t &num) const;
 
 
-        void setString(const std::string &name, const std::string &str);
-        void setNumber(const std::string &name, int32_t num);
+        AFUN_CORE_EXPORT void setString(const std::string &name, const std::string &str);
+        AFUN_CORE_EXPORT void setNumber(const std::string &name, int32_t num);
     };
     };
 }
 }
 
 

+ 5 - 5
include/core/init.hpp

@@ -11,12 +11,12 @@ namespace aFuncore {
         aFuntool::LogLevel level;
         aFuntool::LogLevel level;
     };
     };
 
 
-    extern std::string log_path;
-    extern std::string lang_path;
-    extern std::string varlib_path;
-    extern aFuntool::Logger *aFunCoreLogger;
+    AFUN_CORE_EXPORT extern std::string log_path;
+    AFUN_CORE_EXPORT extern std::string lang_path;
+    AFUN_CORE_EXPORT extern std::string varlib_path;
+    AFUN_CORE_EXPORT extern aFuntool::Logger *aFunCoreLogger;
 
 
-    bool aFunCoreInit(InitInfo *info);
+    AFUN_CORE_EXPORT bool aFunCoreInit(InitInfo *info);
 }
 }
 
 
 #endif //AFUN_INIT_HPP
 #endif //AFUN_INIT_HPP

+ 10 - 10
include/core/msg.hpp

@@ -14,19 +14,19 @@ namespace aFuncore {
     friend class UpMessage;
     friend class UpMessage;
 
 
     public:
     public:
-        explicit Message(const std::string &type);
-        virtual ~Message() = default;
+        AFUN_CORE_EXPORT explicit Message(const std::string &type);
+        AFUN_CORE_EXPORT virtual ~Message() = default;
         [[nodiscard]] const std::string &getType() const {return type;}
         [[nodiscard]] const std::string &getType() const {return type;}
     };
     };
 
 
     class MessageStream {
     class MessageStream {
     protected:
     protected:
         Message *stream;
         Message *stream;
-        [[nodiscard]] virtual Message *_getMessage(const std::string &type) const;
+        [[nodiscard]] AFUN_CORE_EXPORT virtual Message *_getMessage(const std::string &type) const;
 
 
     public:
     public:
-        MessageStream();
-        virtual ~MessageStream();
+        AFUN_CORE_EXPORT MessageStream();
+        AFUN_CORE_EXPORT virtual ~MessageStream();
 
 
         template<class T>
         template<class T>
         [[nodiscard]] T *getMessage(const std::string &type) const {
         [[nodiscard]] T *getMessage(const std::string &type) const {
@@ -35,17 +35,17 @@ namespace aFuncore {
             return ret;
             return ret;
         }
         }
 
 
-        virtual Message *popMessage(const std::string &type);
-        void pushMessage(Message *msg);
+        virtual AFUN_CORE_EXPORT Message *popMessage(const std::string &type);
+        AFUN_CORE_EXPORT void pushMessage(Message *msg);
     };
     };
 
 
     class UpMessage : public MessageStream {
     class UpMessage : public MessageStream {
     protected:
     protected:
         Message *old;
         Message *old;
     public:
     public:
-        explicit UpMessage(const UpMessage *old);
-        ~UpMessage() override;
-        Message *popMessage(const std::string &type) override;
+        AFUN_CORE_EXPORT explicit UpMessage(const UpMessage *old);
+        AFUN_CORE_EXPORT ~UpMessage() override;
+        AFUN_CORE_EXPORT Message *popMessage(const std::string &type) override;
     };
     };
 
 
     class DownMessage : public MessageStream {};
     class DownMessage : public MessageStream {};