fwd declaration/dependency problem in 1.3.7



Hi,

Not sure if I'm doing something stupid, so I thought I'd post here
instead of submitting to Bugzilla. I'm unable to get a compile of the
generated .cc files when there is a bidirectional association of two
interfaces. If I use forward declarations the .c files compile fine but
the .cc files don't reference each other. If I replace the forward
declarations with #includes, the orbit-idl-2 compiler craps out.

I have created a very small test case to demonstrate the problem:

----------------------------------
foo.idl:
----------------------------------

#ifndef __FOO_IDL__
#define __FOO_IDL__
 
module Bug
{
  interface Bar;
 
  interface Foo
  {
    void DoFoo(in Bar bar);
  };
};
 
#endif

----------------------------------
bar.idl:
----------------------------------

#ifndef __BAR_IDL__
#define __BAR_IDL__
 
module Bug
{
  interface Foo;
 
  interface Bar
  {
    Foo GetFoo();
  };
};
 
#endif

----------------------------------
Makefile:
----------------------------------

IDLS=foo.idl bar.idl
 
INCS=-I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0 \
        -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include \
        -I/usr/include/linc-1.0
 
CFILES=${IDLS:.idl=-common.c} ${IDLS:.idl=-skels.c}
${IDLS:.idl=-stubs.c}
CPPFILES=${IDLS:.idl=-cpp.cc}
 
COBJS=${CFILES:.c=.o}
CPPOBJS=${CPPFILES:.cc=.o}
 
all : ${COBJS} ${CPPOBJS}
 
${COBJS} : ${CFILES}
 
${CPPOBJS} : ${CPPFILES} ${CFILES}
 
${CFILES} : ${IDLS}
 
${CPPFILES} : ${IDLS}

clean:
        rm -f *.o *.h *.c *.cc
                                                                                
%-common.c : %.idl
        orbit-idl-2 -l c $<
                                                                                
%-cpp.cc : %.idl
        orbit-idl-2 -l cpp $<
                                                                                
%.o : %.c
        gcc -c ${INCS} $<
                                                                                
%.o : %.cc
        g++ -c ${INCS} $<

----------------------------------
make output:
----------------------------------
orbit-idl-2 -l c foo.idl
orbit-idl-2 2.6.0 compiling
  mode, show preprocessor errors, passes: stubs skels common headers
skel_impl imodule
 
foo.idl:6: Warning: Unresolved forward declaration `Bug::Bar'
orbit-idl-2 -l c bar.idl
orbit-idl-2 2.6.0 compiling
  mode, show preprocessor errors, passes: stubs skels common headers
skel_impl imodule
 
bar.idl:6: Warning: Unresolved forward declaration `Bug::Foo'
gcc -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 foo-common.c
gcc -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 bar-common.c
gcc -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 foo-skels.c
gcc -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 bar-skels.c
gcc -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 foo-stubs.c
gcc -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 bar-stubs.c
orbit-idl-2 -l cpp foo.idl
orbit-idl-2 2.6.0 compiling
  mode, show preprocessor errors, passes: stubs skels common headers
skel_impl imodule
                                                                                
foo.idl:6: Warning: Unresolved forward declaration `Bug::Bar'
orbit-idl-2 -l cpp bar.idl
orbit-idl-2 2.6.0 compiling
  mode, show preprocessor errors, passes: stubs skels common headers
skel_impl imodule
                                                                                
bar.idl:6: Warning: Unresolved forward declaration `Bug::Foo'
g++ -c -I/usr/local/include/orbitcpp-2.0 -I/usr/include/orbit-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/linc-1.0 foo-cpp.cc
In file included from foo-cpp.cc:6:
foo-cpp-common.cc: In member function `void Bug::Foo::DoFoo(Bug::Bar*)':
foo-cpp-common.cc:21: invalid use of undefined type `struct Bug::Bar'
foo-cpp-common.h:20: forward declaration of `struct Bug::Bar'
In file included from foo-cpp.cc:8:
foo-cpp-skels.cc: In static member function `static void
   POA_Bug::Foo::_skel_DoFoo(void*, CORBA_Object_type*,
CORBA_Environment*)':
foo-cpp-skels.cc:40: no method `Bug::Bar::_orbitcpp_wrap'
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/smartpointers/objectptr_var.h:
In
   member function `void _orbitcpp::ObjectPtr_var<O>::free() [with O =
   Bug::Bar]':
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/smartpointers/objectptr_var.h:53:   instantiated from `void _orbitcpp::ObjectPtr_var<O>::ObjectPtr_var() [with
O = Bug::Bar]'
foo-cpp-skels.cc:40:   instantiated from here
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/smartpointers/objectptr_var.h:94: no
   method `Bug::Bar::_nil'
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/smartpointers/objectptr_var.h:95: no
   matching function for call to `release(Bug::Bar*&)'
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/orbitcpp_object.h:51:
candidates
   are: void CORBA::release(CORBA::ServerlessObj*)
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/orbitcpp_object.h:99:
          void CORBA::release(CORBA::Object*)
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/orbitcpp_orb.h:46:
       void CORBA::release(CORBA::ORB*)
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/orbitcpp_poa.h:256:
        void CORBA::release(PortableServer::POA*)
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/orbitcpp_typecode.h:212:
             void CORBA::release(CORBA::TypeCode*)
/usr/local/include/orbitcpp-2.0/orbitcpp/orb-cpp/smartpointers/objectptr_var.h:96: no
   method `Bug::Bar::_nil'
make: *** [foo-cpp.o] Error 1






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]