[boost-users] boost::function object alignment question

31 May
2008
31 May
'08
8:15 a.m.
Hi I have a win32 static library with a class like this : typedef boost::function<void (int)> TimerCallbackType; class TimerManager { public: int addTimer(int interval, TimerCallbackType callback); }; I use this lib in a Win32 exe, but it crashed on calling TimerManager::addTimer(), the error is: "Run-time check failure #0 - The value of ESP was not properly saved across a function call ... ". Both the exe and lib are compiled with "Struct Alignment" set to "4 Bytes". Finally, I find out a way make it work -- include the boost like this : #pragma pack(push,8) #include <boost/xxxx> #pragma pop() But, I don't know why? Could anybody here help to clear this question? I'm using MS Viusal C++ 2005. Thanks! -- Neil.Fang.CN
6217
Age (days ago)
6217
Last active (days ago)
0 comments
1 participants
participants (1)
-
Neil Fang