My solution in VC++2012 includes some executable programs & some DLLs. One of project is DataReceiver which output is a program, dataReceiver.exe. One DLL is called DataInterface, whose output is DataInterface.dll.
In main program of DataReceiver, it declares an object DataIn via class DataInput, which is defined at DataInterface project. I inserted some logging message and then found strange things happen: the DataIn's constructor seems being skipped. The detail is described as below:
The snippet of main program of DataReceiver is as below:
int main(int argc, char* argv[])
{
boost::thread_group thGroup;
boost::asio::io_service io_service;
logMsg ("standebug: DataReceiver/main()\n");
try
{
logMsg ("standebug: DataReceiver/main():try\n");
DataInput dataIn;
cout << "K00.00.15.06.01\nNow:"<< boost::posix_time::to_iso_string(boost::posix_time::microsec_clock::local_time()) << endl;
logMsg ("standebug: DataReceiver/main():to start()\n");
dataIn.Start();
....................
}
And the DataInput's constructor begins as:
DataInput::DataInput(void)
{
m_mode = 0;
logMsg ("standebug: DataInput::DataInput\n");
cout << "standebug: DataInput::DataInput\n";
m_OnChangedFn_ptr = NULL;
....................
}
The DataInput's method, Start() begins as:
void DataInput::Start(void)
{
logMsg ("standebug: dataInput: Start\n");
try
{
..........
}
After building them successfully, I ran 'DataReceiver.exe' under MS Command Prompt, I found the logging message is as:
standebug: DataReceiver/main()
standebug: DataReceiver/main():try
standebug: DataReceiver/main():to start()
It's very obviously, after DataIn is declared, neither DataIn.DataInput() or DataIn.Start() had been executed, why?
From logging message, DataIn's constructor is never ran. How come?