<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1492" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><FONT size=2>
<P>"We didn't have this problem with VC6 - is this due to changes
(enhancements?) in the linker?"</P>
<P>There were issues with templates handled differently in the VC7 compiler, it
caused problems with Qt but these seem to have been fixed (Qt? VC?) as you can
compile with later versions of VC. Even with VC6 you needed the latest, patched
version to compile Qt.</P>
<P>Here's the similar issue, except with the '__declspec(dllexport)' from the Qt
archive:</P>
<P></FONT><A
href="http://lists.trolltech.com/qt-interest/2002-03/thread00119-0.html"><U><FONT
color=#0000ff
size=2>http://lists.trolltech.com/qt-interest/2002-03/thread00119-0.html</U></FONT></A></P><FONT
size=2></FONT></DIV>
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
omniorb-list-bounces@omniorb-support.com
[mailto:omniorb-list-bounces@omniorb-support.com] <B>On Behalf Of </B>Mark
Johnson<BR><B>Sent:</B> Wednesday, May 25, 2005 4:04 PM<BR><B>To:</B>
omniORB<BR><B>Subject:</B> [omniORB] VC7.1, Templates, and
DLLs<BR><BR></FONT></DIV><FONT size=-1><FONT face=Arial>Hi,<BR><BR>I've been in
the process of upgrading our development environment from VC6 (Visual Studio 6)
to VC7.1 (Visual Studio .NET 2003) and ran across some problems. This was
caused by a combination of several ways we use omniORB and I'm not sure if
anyone else has run into this. Here's the setup:<BR><BR>- We have
implemented Cos Notification services and use the flattened-tie classes
generated by the idl compiler (omniidl -bcxx -Wba,tf etc.). The idl
compiler generates template definitions for these such as the following
(pertinent part only, from the header file for
CosNotifyCom.idl):<BR><BR><snip><BR><BR>template <class _dyn_attr
_omniT><BR>class _dyn_attr POA_CosNotifyComm_StructuredPushSupplier_tie :
public virtual
POA_CosNotifyComm::StructuredPushSupplier<BR>{<BR><BR><snip><BR><BR>- We
link all our stubs into one dll, thus use the USE_stub_in_nt_dll define for all
programs. The stubs for CosNotification, CosNotifyComm,
CosNotifyChannelAdmin, etc., are all included in this stub dll.<BR><BR>What
happens when we compile an application that makes use of one of these templates,
and the fact that we're defining USE_stub_in_nt_dll, the method signature
results in something like:<BR><BR></FONT></FONT>__declspec(dllimport) public:
__thiscall POA_CosNotifyComm_StructuredPushSupplier_tie<CLASS
service_i="">::POA_CosNotifyComm_StructuredPushSupplier_tie<CLASS
service_i="">(class Service_i *,bool)</CLASS></CLASS><BR><FONT size=-1><FONT
face=Arial><BR>This compiles fine, but throws a LNK2019: unresolved external
symbol during the link, due to the "__declspec(dllimport)" I believe, since the
template expansion is not part of the stubs dll, but expanded locally in the
object file generated by the compiler, and the storage class attribute is
dllimport.<BR><BR>The fix was to hack the header file and remove the _dyn_attr
from the template definitions. This changed the storage class attributes
on the generated templates so they could be linked from the local object
file. We didn't have this problem with VC6 - is this due to changes
(enhancements?) in the linker?<BR><BR>I'm wondering if the modifier "_dyn_attr"
should be removed from template definitions generated by the idl
compiler?<BR><BR>I'm also trying to fix a problem with duplicate
definitions:<BR><BR></FONT></FONT>cos.lib(any.obj) : error LNK2005: "public:
__thiscall _CORBA_Unbounded_Sequence<CLASS
corba::any="">::~_CORBA_Unbounded_Sequence<CLASS corba::any="">(void)"
(??1?$_CORBA_Unbounded_Sequence@VAny@CORBA@@@@QAE@XZ) already defined in
omniDynamic406_rtd.lib(omniDynamic406_rtd.dll)</CLASS></CLASS><BR><FONT
size=-1><FONT face=Arial><BR>We have some utilities that work on CORBA::Any
types and it seems the template for _CORBA_Unbounded_Sequence< CORBA::Any>
was generated in our code as well as in omniDynamic (???).<BR><BR>Any
suggestions or comments appreciated!<BR><BR>Mark<BR><BR></FONT></FONT>
<DIV class=moz-signature>-- <BR><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana">Mark A.
Johnson</SPAN><BR><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(255,0,0); FONT-FAMILY: Verdana">NetQoS,
Inc.</SPAN><BR><SPAN
style="FONT-SIZE: 7.5pt; COLOR: gray; FONT-FAMILY: Verdana">60 E. Marie
Ave<BR>Suite 204<BR>West St. Paul, MN 55118<BR>Office: (01)
651.552.2111<BR><U><BR><I><A
href="mailto:mark@redpt.com">mark@redpt.com</A><BR><A
href="http://www.redpt.com/"
target=3D_blank>http://www.redpt.com</A></I></U></SPAN>
<P><BR></P></DIV></BODY></HTML>