Template class object across library interface function

N

Neil.Fang.CN

I have a Win32 static lib, have a class member function 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, the error is:
"Run-time check failure #0 - The value of ESP was not properly saved
across a function call ... ".
It seems that the destructor of boost::function break the stack.. But
boost::function object work fine in the exe project, only crashed in
this occasion - call the "addTimer()" of the lib.

In this situation(call "addTimer" of lib), how the boost::function
template be instantiated? Does the copy constructor instantiated in
the exe project, the destructor instantiated in the lib project? So,
maybe the setting of the two projects is different, make the
constructor/destructor mismatched?

I'm using MS Visual C++ 8.0

$B!]!](BNeil
 
N

Neil.Fang.CN

Hello

I have find the problem, the crash was caused due to the “Struct
Member Alignment” is different in these two VC project.

But I’m still not clear about the template instantiations in this
occasion. Could you give me some explain? Thanks.

-- Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top