[Quickfix-users] QuickFIX functionality in a separate DLL
Brought to you by:
orenmnero
From: Nigel S. <nig...@gm...> - 2011-06-04 15:32:21
|
Hi, I am trying to place the QuickFIX functionality in a separate DLL which would be called from the main trading application. As a minimum for placing orders, the DLL would have the following exported functions: Connect() EnterOrder() Disconnect() Connect() would be called at the start of the trading day and would keep the QuickFIX session open. While this session is open, orders can be placed using EnterOrder(). At the end of the trading day, Disconnect() would call initiator.stop() and close the session. If the initiator and application objects are created in Connect(), then these would need to become class-level objects so as not to go out-of-scope when Connect() ends. Adapting the tradeclient sample to make both application and initiator as class-level objects causes two compile-time errors. If there a way to get this approach to work or otherwise a way to achieve the objective of a separate DLL where Connect() could keep the QuickFIX session open? I would be very grateful for any help. Nigel Sperinck // Define as Class-level objects Application application; FIX::SocketInitiator initiator; Causes compile-time error C2512: 'FIX::SocketInitiator' : no appropriate default constructor available __declspec(dllexport) void Connect() { std::string file = "C:\\tradeclient.cfg"; try { FIX::SessionSettings settings( file ); FIX::FileStoreFactory storeFactory( settings ); FIX::FileLogFactory logFactory( settings ); initiator( application, storeFactory, settings, logFactory ); Causes compile-time error C2064: term does not evaluate to a function taking 4 arguments initiator.start(); } catch ( std::exception & e ) { std::cout << e.what(); } } __declspec(dllexport) void Disconnect() { initiator.stop(); } __declspec(dllexport) void EnterOrder() { // In production, order details would be passed to this function application.queryEnterOrder(); } |