Skip to content

Commit 6b55aa9

Browse files
committed
修正Linux下的问题
1 parent 1217741 commit 6b55aa9

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

QuantBox_CTP_Quote/QuantBox_CTP_Quote.depend

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
<set>
258258
<string>
259259

260-
1427789621 source:/home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_CTP_Quote/main.cpp
260+
1427872161 source:/home/mep/dev/broker/oss/QuantBox_XAPI/QuantBox_CTP_Quote/main.cpp
261261
"stdafx.h"
262262
"../include/ApiHeader.h"
263263
"../include/QueueEnum.h"

QuantBox_Queue/MsgQueue.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ void CMsgQueue::RunInThread()
8989
// 清理线程
9090
m_hThread = nullptr;
9191
m_bRunning = false;
92-
}
92+
}

QuantBox_XAPI/XApiC.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "stdafx.h"
22

3+
#include <stdio.h>
34
#include <string.h>
45
#include "../include/XApiC.h"
56
#include "../include/QueueHeader.h"
@@ -21,7 +22,7 @@ void* X_LoadLib(char* libPath)
2122
#if defined WINDOWS
2223
return LoadLibraryExA(libPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
2324
#else
24-
return dlopen(libPath, RTLD_LAZY);
25+
return dlopen(libPath, RTLD_NOW);
2526
#endif
2627
}
2728

@@ -41,7 +42,8 @@ char* X_GetLastError()
4142
return (char*)lpMsgBuf;
4243
#else
4344
extern int errno;
44-
return strerror(errno);
45+
errno = 0;
46+
return dlerror();
4547
#endif
4648
}
4749

QuantBox_XAPI/XApiImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "stdafx.h"
2+
#include <stdio.h>
23
#include <string.h>
34
#include "XApiImpl.h"
45

@@ -122,7 +123,6 @@ bool CXApiImpl::Init()
122123
return true;
123124
}
124125
}
125-
126126
return false;
127127
}
128128

QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ class CXSpiImpl :public CXSpi
5151
int main(int argc, char* argv[])
5252
{
5353
CXSpiImpl* p = new CXSpiImpl();
54+
#if defined WINDOWS
5455
char DLLPath1[250] = "C:\\Program Files\\SmartQuant Ltd\\OpenQuant 2014\\XAPI\\CTP\\x86\\QuantBox_CTP_Quote.dll";
5556
char DLLPath2[250] = "C:\\Program Files\\SmartQuant Ltd\\OpenQuant 2014\\XAPI\\CTP\\x86\\QuantBox_CTP_Trade.dll";
57+
#else
58+
char DLLPath1[250] = "libQuantBox_CTP_Quote.so";
59+
char DLLPath2[250] = "libQuantBox_CTP_Trade.so";
60+
#endif
5661

5762
ServerInfoField m_ServerInfo1 = { 0 };
5863
ServerInfoField m_ServerInfo2 = { 0 };
@@ -88,8 +93,13 @@ int main(int argc, char* argv[])
8893
pApi1->RegisterSpi(p);
8994
pApi2->RegisterSpi(p);
9095

91-
pApi1->Connect("D:\\", &m_ServerInfo1, &m_UserInfo, 1);
96+
#if defined WINDOWS
97+
pApi1->Connect("D:\\", &m_ServerInfo1, &m_UserInfo, 1);
9298
pApi2->Connect("D:\\", &m_ServerInfo2, &m_UserInfo, 1);
99+
#else
100+
pApi1->Connect("./", &m_ServerInfo1, &m_UserInfo, 1);
101+
pApi2->Connect("./", &m_ServerInfo2, &m_UserInfo, 1);
102+
#endif
93103

94104
getchar();
95105

0 commit comments

Comments
 (0)