[omniORB] Linking problems in MSVC++ 5.0

Sai-Lai Lo S.Lo@orl.co.uk
09 Nov 1998 17:56:31 +0000


>>>>> Dee Jay Randall writes:

>   I did manage to build the echo example, and it worked fine.
> Yes, in eg1.obj, the external symbol name of CORBA::string_free
> is ?string_free@CORBA@@YAXPAD@Z

>   Here is what I get when I do a dumpbin on eg1.obj and server.obj
> (server.obj is my file that is causing the trouble):

> eg1.obj:
> 024 00000000 UNDEF  notype ()    External     | ?string_free@CORBA@@YAXPAD@Z
> (void __cdecl CORBA::string_free(char *))

> server.obj:
> 051 00000000 UNDEF  notype ()    External     | ?string_free@CORBA@@SAXPAD@Z
> (public: static void __cdecl CORBA::string_free(char *))

>   The "public: static" part is obviously the problem (right?), but how
> do I get rid of it?

I think I know what is wrong. Do you have a pre-2.6.x version in your
development tree? I think when you built server.obj, the omniORB2 header
files from a pre-2.6.x distribution got included instead of the 2.6.x
headers.

One of the changes in 2.6.x is the use of C++ namespace to represent CORBA
modules when compiled with MSVC++. This is why the signature of
CORBA::string_free is now:
     void __cdecl CORBA::string_free(char *);

In pre-2.6.x versions, CORBA is a C++ class, hence the signature of
CORBA::string_free is:

   public: static void __cdecl CORBA::string_free(char *)


By the way, there is a guard against accidentally linking stubs generated
by the 2.6.x omniidl2 with the pre-2.6.x runtime. The linkage would fail at
least with the undefined symbol omniORB_2_6, which is only present in the
2.6.x runtime. In your case, this undefined symbol must have been hidden by
the hundreds of undefined symbols causes by the namespace change.

Obviously, you just have to remove the old headers from your development
tree and make sure that the 2.6.x headers are picked up.


Tell us if this solves your problem.


Regards,

Sai-Lai


-- 
Dr. Sai-Lai Lo                          |       Research Scientist
                                        |
E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
                                        |       24a Trumpington Street
Tel:            +44 223 343000          |       Cambridge CB2 1QA
Fax:            +44 223 313542          |       ENGLAND