[Ace-users] [tao-users] Compile error with CosNotify_Service

Lothar Werzinger lothar at tradescape.biz
Tue Sep 4 20:00:08 CDT 2007


Hi,

PRF is attached

in our app we have a piece of code like this:

  TAO_CosNotify_Service * p_notifyService = 
    ACE_Dynamic_Service<TAO_CosNotify_Service>::instance("testNotifyService");
  
  p_notifyService->init_service(mv_orb.in());
  
  CosNotifyChannelAdmin::EventChannelFactory_var mv_notifyFactory = 
    p_notifyService->create(
      v_rootPOA.in()
    );

with TAO 1.6 we get the following compile error:

src/testhelper/corba/NotificationLoader.cpp: In 
constructor 'tradescape::test::NotificationLoader::NotificationLoader()':
src/testhelper/corba/NotificationLoader.cpp:72: error: no matching function 
for call to 'TAO_CosNotify_Service::create(PortableServer::POA*)'
/opt2/linux/i686/ACE/1.6/ACE_wrappers/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h:63: 
note: candidates are: virtual CosNotifyChannelAdmin::EventChannelFactory* 
TAO_CosNotify_Service::create(PortableServer::POA*, const char*)

If I look into 
ACE_wrappers/TAO/orbsvcs/orbsvcs/Notify/Service.h
I see that in class TAO_Notify_Service the create method has changed to 
include a second parameter which is a default parameter.

  /// Create the Channel Factory.
  virtual CosNotifyChannelAdmin::EventChannelFactory_ptr create (
      PortableServer::POA_ptr default_POA,
      const char* factory_name = "EventChannelFactory") = 0;

I have no clue why the compiler does not use the default parameter.

however it is strange that in 
ACE_wrappers/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h
the class TAO_CosNotify_Service inherits from TAO_Notify_Service
but does NOT override the pure virtual method from TAO_Notify_Service

When I change my code to

  CosNotifyChannelAdmin::EventChannelFactory_var mv_notifyFactory = 
    p_notifyService->create(
      v_rootPOA.in(),
      "EventChannelFactory"
    );

it compiles fine, but breaks backward compatibility with older TAO versions.

I suspect that TAO_CosNotify_Service SHOULD override the pure virtual method 
from TAO_Notify_Service and that this is what causes the compile error.

Johnny, can you please have a quick look into that. Thanks in advance!

Lothar
-------------- next part --------------
To: ace-bugs at cs.wustl.edu
Subject: [area]: [synopsis]

    ACE VERSION: 5.6

    HOST MACHINE and OPERATING SYSTEM:
Linux zaphod 2.6.15-28-amd64-generic #1 SMP PREEMPT Wed Jul 18 22:51:22 UTC 2007 x86_64 GNU/Linux

    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
    COMPILER NAME AND VERSION (AND PATCHLEVEL):
gcc (GCC) 4.1.2

    THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
    specific file, simply state which one]:
#define ACE_HAS_XML_SVC_CONF
#include "ace/config-linux.h"

    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual
    C++)]:
# configure ACE/TAO for our use

templates=automatic
debug=1
optimize=1
exceptions=1
threads=1
inline=1
rtti=1
versioned_so=1

stl=1
ssl=1
zlib=1
ipv6=1
java=1
cidl=0
boost=0
uses_wchar=0
negotiate_codesets=0
versioned_namespace=0

# Enable TAO ostream operator generation
gen_ostream=1

# Disable the RCSID for release/non-debug builds.
CPPFLAGS += -DACE_USE_RCSID=0

CC = /opt2/linux/ix86/x86_64-pc-linux-gnu/bin/gcc
CXX = /opt2/linux/ix86/x86_64-pc-linux-gnu/bin/g++
CFLAGS += -m32 -I/opt2/linux/i686/include
CCFLAGS += -m32 -I/opt2/linux/i686/include
LDFLAGS += -m32 -I/opt2/linux/i686/include -L/opt2/linux/i686/lib

TAO_IDL_PREPROCESSOR = /opt2/linux/ix86/x86_64-pc-linux-gnu/bin/gcc

include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU


    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
    (used by MPC when you generate your own makefiles):
// configure ACE/TAO for our use

stl                 = 1
ssl                 = 1
qos                 = 1
zlib                = 1
ipv6                = 1
java                = 1
cidl                = 0
boost               = 0
uses_wchar          = 0
gen_ostream         = 1
negotiate_codesets  = 0
versioned_namespace = 0


    AREA/CLASS/EXAMPLE AFFECTED:
[What example failed?  What module failed to compile?]

    DOES THE PROBLEM AFFECT:
        COMPILATION?
        LINKING?
            On Unix systems, did you run make realclean first?
        EXECUTION?
        OTHER (please specify)?
[Please indicate whether ACE, your application, or both are affected.]

    SYNOPSIS:
[Brief description of the problem]

    DESCRIPTION:
[Detailed description of problem.  Don't just say "<blah>
doesn't work, here's a fix," explain what your program does
to get to the <blah> state. ]

    REPEAT BY:
[What you did to get the error; include test program or session
transcript if at all possible.  ]

    SAMPLE FIX/WORKAROUND:
[If available ]


More information about the Ace-users mailing list