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

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


Hi, Duncan and all omniORB guys

Finally, I solved the problem about process down under Win32.

The crashes is because this process attempts to read an invalid address
"CosNotifyComm::StructuredPushConsumer::_PD_repoId" due to this symbol
is not properly exported under Win32.

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. It seems omniidl can not produce correct stub/skeleton under
this situation.

Best Regards,
Edward Lin