diff --git a/Config.cpp b/Config.cpp index 5de5144d..bc143301 100644 --- a/Config.cpp +++ b/Config.cpp @@ -1,7 +1,9 @@ #include "Config.h" +TConfig Config; + // 初始化,各字段为0 -Config::Config() +TConfig::TConfig() { // 实际内存大小,减去头部大小 Length = sizeof(this) - (int)&Length - (int)this; diff --git a/Config.h b/Config.h index 2bfb1804..56d5351e 100644 --- a/Config.h +++ b/Config.h @@ -10,15 +10,17 @@ #pragma pack(1) // 配置信息 -class Config +class TConfig { public: int Length; // 数据长度 // 初始化,各字段为0 - Config(); + TConfig(); }; #pragma pack(pop) // 恢复对齐状态 +extern TConfig Config; + #endif