[omniORB] Problem instantiating a tie object with a specific key

Constantin Adam ctin@comet.columbia.edu
Fri, 7 Jul 2000 18:59:27 -0400 (EDT)


Hi,

We have the following problem:

We want to instantiate a tie object with a given key on Windows NT.

The IDL interface we want to tie to is defined inside a module:

---

module A {
    interface dummy {
        void echo ();
    };
};

---

Then, we use the following code to instantiate the object:

---

#include "a.hh"

class dummy_i {
    public:
        void echo () { }
};

int main ()
{
    // initialization CORBA
    dummy_i d;
    omniORB::objectKey key;
    omniORB::generateNewKey (key);
    _tie_A_dummy<dummy_i, 1> *ptr = new _tie_A_dummy<dummy_i, 1>
        (&d, key);
    // ...
    // do other stuff
    return 0;
}

---

This code will not compile.  It will give the following error:

---

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

test.cpp
c:\test\a.hh(217) : error C2437: '_sk_dummy' : already initialized

c:\test\a.hh(217) : while compiling class-template member function
'__thiscall _tie_A_dummy<class dummy_i,1>::_tie_A_dummy<class
dummy_i,1>(class dummy_i *,const struct omniObjectKey &)'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

---

However, if we edit the stub file (a.hh) by removing any scoping with
A:: and replacing that with 'using namespace A;', the code will
compile.

It looks like a compiler problem, but I was wondering whether anybody
else knows how to solve this problem without having to edit the stubs
every time.  We are using Visual Studio 6.0 with Service Pack 4.

Thank you,

Constantin