[omniORB] Re: Process on Win32 crash while calling _this(),solved

M300_ªLÀAÀs³Bªø edward_lin@iwin.com.tw
Wed Nov 13 04:09:00 2002


Hi, all

Finally, I found out the problem.
The crashes is because the process attempts to read an invalid address
"CosNotifyComm::StructuredPushConsumer::_PD_repoId" due to the "_PD_repoId"
is not properly exported.

Let's see the following code, this code is OK!

#include <omniORB4/CORBA.h>
#include <COS/CosNotifyComm.hh>
#include <iostream>

using namespace std;

int main()
{
  cout << "_PD_repoId = '" <<
CosNotifyComm::StructuredPushConsumer::_PD_repoId << "'" << endl;
  return 0;
}

But if I add one more COS header file before CosNotifyComm.hh like below,
the process is down.

#include <omniORB4/CORBA.h>
#include <COS/CosNotification.hh> // including this file cause process down.
#include <COS/CosNotifyComm.hh>
#include <iostream>

Wow..., interesting.

This time, I preprocess the source code to the files, and see difference

*********************************************
Including <COS/CosNotification.hh> and <COS/CosNotifyComm.hh> generates
output:

  class StructuredPushConsumer {
  public:
    // others I'm not interested
    static  const char* _PD_repoId;
  };

*********************************************
Including <COS/CosNotification.hh> only generates output:

  class StructuredPushConsumer {
  public:
    // others I'm not interested
    static __declspec(dllimport) const char* _PD_repoId;
  };

Yes, the answer is "CosNotifyComm::StructuredPushConsumer::_PD_repoID" is
not exported.