[omniORB] Why this call failed in dll?

Bing Zhang bzhang@sohar.com
Thu, 24 Sep 1998 18:14:43 -0700


I have a very simple class in file services.h:

class ServiceClass {
   unsigned long caminStartTime;
public:
  ServiceClass();
 resetStartTime(unsigned long delta);
 unsigned long currentTime();
};
extern ServiceClass Service;

In file service.cc,

ServiceClass::ServiceClass() {
  caminStartTime = (unsigned long) timeGetTime();
}
ServiceClass::resetStartTime(unsigned long delta) {
        caminStartTime = delta;
}
unsigned long ServiceClass::currentTime() {
      return (unsinged long) timeGetTime();
}
ServiceClass Service;

In my main(), I call

Service.resetStartTime(0);

This works fine if I compile my main, application codes and omniORB2
source code (I modified some part of omniORB codes to suit our
situation) together with service.cc.

But when I put the service.cc along with omniORB source code in a dll
and link my application code to this
dll, every time this call is made, it throws out a "The instruction at
xxxxxx reference memory at xxxxxxx. The memory can not be wrriten" error
when  the statement

caminStartTime = delta;

is executed. But the call Service.currentTime() runs ok. So I think the
system does not want me to modify the member variable of Service.

I am using vc++ 5.0 and omniORB 2.4. I built the dll by adding my source
codes to the dir.mk of omniORB.

What is wrong?

Bing