Forward referencing problem

Fredrik Jonsson fredrik.jonsson@sea.ericsson.se
Tue, 17 Feb 1998 15:18:21 +0100


On Tuesday, February 17, 1998 10:51 AM, mbini@dada.it [SMTP:mbini@dada.it] 
wrote:
> (In IDL the whole issue makes sense with interfaces only)
>
> include the generated skeleton file

Including generated skeleton source?

Normally I just want to compile generated code.

The skeleton files doesn't compile only on forward declarations,
atleast not for me in omniOrb2.4.0

So, once again, what is the common procedure to resolve circular
reference problems like the one attached?

--Fredrik Jonsson


Example:

interface B;
interface A {
	B CreateB();
};

>omniidl2 -h .h -s _sk.cpp a.idl

If you now try to compile the generated file you get a compilation error:

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

        cl /c /GX /GR /D WIN32 /D _MBCS /D _CONSOLE /nologo /MD /D NDEBUG /I 
\\s
tpc03\sde\rep\lib_nt\orl\omniorb2.4.0\include /D __WIN32__ /D __x86__ /D 
__OSVER
SION__=4 /D __NT__ /D __OMNIORB2__ /I \\stpc03\sde\rep\lib_nt\rw\tools703 /D 
_RW
TOOLSDLL /D RW_NO_STL ttt_sk.cpp
ttt_sk.cpp
ttt_sk.cpp(25) : error C2027: use of undefined type 'B'
ttt_sk.cpp(25) : error C2440: '=' : cannot convert from 'class A *' to 'class 
B
*'
                              Types pointed to are unrelated; conversion 
require
s reinterpret_cast, C-style cast or function-style cast
ttt_sk.cpp(64) : error C2665: 'release' : none of the 10 overloads can 
convert p
arameter 1 from type 'class B *'
ttt_sk.cpp(78) : error C2665: 'release' : none of the 10 overloads can 
convert p
arameter 1 from type 'class B *'
ttt_sk.cpp(83) : error C2665: 'release' : none of the 10 overloads can 
convert p
arameter 1 from type 'class B *'
ttt_sk.cpp(96) : error C2665: 'release' : none of the 10 overloads can 
convert p
arameter 1 from type 'class B *'
ttt_sk.cpp(101) : error C2665: 'release' : none of the 10 overloads can 
convert
parameter 1 from type 'class B *'
ttt_sk.cpp(128) : error C2027: use of undefined type 'B'
ttt_sk.cpp(128) : error C2664: 'NP_alignedSize' : cannot convert parameter 1 
fro
m 'class B *' to 'class A *'
ttt_sk.cpp(130) : error C2027: use of undefined type 'B'
ttt_sk.cpp(130) : error C2664: 'void __cdecl A::marshalObjRef(class A *,class 
Ne
tBufferedStream &)' : cannot convert parameter 1 from 'class B *' to 'class A 
*'

NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

--FJ