diff --git a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp index fbc26008..8da203fb 100644 --- a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp +++ b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.cpp @@ -1,7 +1,6 @@ // vnctpmd.cpp : 定义 DLL 应用程序的导出函数。 // -#include "stdafx.h" #include "vnctpmd.h" ///------------------------------------------------------------------------------------- @@ -46,7 +45,11 @@ void getChar(dict d, string key, char *value) const char *buffer = s.c_str(); //对字符串指针赋值必须使用strcpy_s, vs2013使用strcpy编译通不过 //+1应该是因为C++字符串的结尾符号?不是特别确定,不加这个1会出错 +#ifdef _MSC_VER //WIN32 strcpy_s(value, strlen(buffer) + 1, buffer); +#elif __GNUC__ + strncpy(value, buffer, strlen(buffer) + 1); +#endif } } }; @@ -817,4 +820,4 @@ BOOST_PYTHON_MODULE(vnctpmd) .def("onRspUnSubForQuoteRsp", pure_virtual(&MdApiWrap::onRspUnSubForQuoteRsp)) .def("onRtnForQuoteRsp", pure_virtual(&MdApiWrap::onRtnForQuoteRsp)) ; -}; \ No newline at end of file +}; diff --git a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h index 20ab5b39..aa94f580 100644 --- a/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h +++ b/vn.ctp/vnctpmd/vnctpmd/vnctpmd.h @@ -1,7 +1,9 @@ //说明部分 //系统 +#ifdef WIN32 #include "stdafx.h" +#endif #include #include