[omniORB] Re: msvc7.1 build error due to recent patch

Luke Deller ldeller at xplantechnology.com
Thu Nov 24 11:41:38 GMT 2005


On Wed, 2005-11-09 at 11:09 +0000, Duncan Grisby wrote:
> Sorry, I've lost some context here. What exactly is the problem?
> Current CVS builds fine for me on VC++ 7.1.

Sorry about the confusion; I think my company's mail server blocked my
first email entirely due to a .bat attachment.  I'll start again.

A patch was introduced to omni4_0_develop CVS branch which causes a
build error in my code using VC++ 7.1.  OmniORB itself builds fine.
The patch which causes the problem is from here:
http://www.omniorb-support.com/pipermail/omniorb-list/2005-May/026765.html

The problem occurs when implementing an interface whose IDL contains a
constant.  The linker complains that a symbol for the C++ static class
member is defined twice: once in the generated skeleton file and
once in the file containing the servant implementation.

Here is a small example which demonstrates the problem (inline this
time, beware line wrapping).  It builds with omniORB-4.0.6, but not with
current CVS (omni4_0_develop branch).

===== constbug.idl =====
module testmod {
    interface testiface {
        const long TESTCONST = 42;
        long echo (in long msg);
    };
};

===== main.cc =====
#include "constbug.hh"
#include <stdio.h>

class constbug_i : public POA_testmod::testiface
{
    CORBA::Long echo(CORBA::Long msg) {
        return msg;
    }
};

int main(int argc, char *argv[])
{
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
    PortableServer::POAManager_var poamgr = poa->the_POAManager();
    poamgr->activate();
    constbug_i * impl = new constbug_i();
    testmod::testiface_var objref = impl->_this();
    CORBA::String_var str = orb->object_to_string(objref);
    printf("%s\n", str.in());
    orb->shutdown(true);
}

===== w32build.bat =====
set OMNIORB_BASE=c:\path\to\omniORB-20051104
set MSVS_BASE="c:\Program Files\Microsoft Visual Studio .NET 2003"

call %MSVS_BASE%\Vc7\bin\vcvars32.bat

%OMNIORB_BASE%\bin\x86_win32\omniidl -bcxx constbug.idl

cl -MD /Fea.exe /D__x86__ /D__NT__ /D__OSVERSION__=4 /D__WIN32__ -I %
OMNIORB_BASE%\include *.cc /link /LIBPATH:%OMNIORB_BASE%\lib\x86_win32
omniDynamic4.lib omniORB4.lib omnithread.lib ws2_32.lib advapi32.lib

==== end ====


**********************************************************************************************

Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege.  If you are not
the intended recipient you must not use, distribute or copy this
email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of XPlan Technology.

It is the duty of the recipient to virus scan and otherwise test the
information provided before loading onto any computer system.
Xplan Technology does not warrant that the
information is free of a virus or any other defect or error.
**********************************************************************************************




More information about the omniORB-list mailing list