Hi,
Petr Mladek wrote:
It seems that the project testtools includes one more complex template for
getCppuType. I got this build error:
Making: ../../unxlngi6.pro/lib/bridgetest.uno.so
g++ -Wl,-z,combreloc -Wl,-z,defs -Wl,-rpath,'$ORIGIN' -shared -Wl,-O1
-Wl,--version-script ../../unxlngi6.pro/misc/component.LINUXIgcc3_bridgetest.uno.map
-L../../unxlngi6.pro/lib -L../lib
-L/usr/src/packages/BUILD/ooo-build-src680.139.3/build/src680-m139/solenv/unxlngi6/lib
-L/usr/src/packages/BUILD/ooo-build-src680.139.3/build/src680-m139/solver/680/unxlngi6.pro/lib
-L/usr/src/packages/BUILD/ooo-build-src680.139.3/build/src680-m139/solenv/unxlngi6/lib
-L/usr/lib/jvm/java/lib -L/usr/lib/jvm/java/jre/lib/i386 -L/
usr/lib/jvm/java/jre/lib/i386/client
-L/usr/lib/jvm/java/jre/lib/i386/native_threads -L/usr/X11R6/lib
-L/usr/lib/xulrunner-1.8 ../../unxlngi6.pro/slo/bridgetest.uno_version.o ../../unxlngi6.pro/slo/bridgetest.uno_description.o
-o ../../unxlngi6.pro/lib/bridgetest.uno.so ../../unxlngi6.pro/slo/bridgetest.o ../../unxlngi6.pro/slo/multi.o
-luno_cppu -luno_cppuhelpergcc3 -luno_sal -ldl -lpthread -lm -Wl,-Bdynamic
-lst
lport_gcc
../../unxlngi6.pro/slo/bridgetest.o: In function `void
com::sun::star::uno::operator<<=<test::testtools::bridgetest::TestPolyStruct<unsigned
short> >(com::sun::star::uno::Any&,
test::testtools::bridgetest::TestPolyStruct<unsigned short>
const&)':/usr/src/packages/BUILD/ooo-build-src680.139.3/build/src680-m139/solver/680/unxlngi6.pro/inc/com/sun/star/uno/Any.hxx:219:
undefined reference to `com::sun::star::uno::Type const&
getCppuType<test::testtools::bridgetest::TestPolyStruct<unsigned short>
(test::testtools::bridgetest::TestPolyStruct<unsigned short> const*)'
collect2: ld returned 1 exit status
dmake: Error code 1, while making '../../unxlngi6.pro/lib/bridgetest.uno.so'
'---* tg_merge.mk *---'
ERROR: Error 65280 occurred while
making /usr/src/packages/BUILD/ooo-build-src680.139.3/build/src680-m139/testtools/source/bridgetest
The template for this function seems to be declared in
inc/test/testtools/bridgetest/TestPolyStruct.hdl
What do you think? Should it be moved to Type.h as well?
Generally hdl files are generated and there could be an open-ended
number of them.
Your example (and the previous case of the Sequence<...> template) show
that the new solution doesn't work with parameterized UNO types. The
reason for this is, that C++ doesn't have partial specialization for
function templates. Instead overloading can be used, but that runs into
the same issue as the original overloading case: the overloads are not
known at the point where the calling template is defined.
There are ways around that, but they require bigger changes than the
changes Stephan did so far. The options I can see are:
1. Use the crutch by which you can emulate partial specialization for
function templates through a helper class template:
// helper template
template <typename T>
struct GetCppuType
{ inline static Type getType(); };
// general template definition
template <typename T>
Type getCppuType(T*) { return GetCppuType<T>::getType(); }
// explicit specializations
template <>
Type GetCppuType<T>::getType() {...}
// partial specializations
template <typename T>
struct GetCppuType< Sequence<T> >
{ Type getType() { ...} };
2. Replace ::getCppuType by overloaded functions found by
argument-dependent lookup. For compatibility with existing code, the new
function placed into the namespace of the type to which it applies
should get a new name and there should be a global getCppuType tempalte
that forwards to the new function (called by an unqualified name(.
BTW: I have shortly considered whether using a template-id to call
getCppuType<>(...) in Any.hxx (and similar places) would improve
anything, because the clause about selecting candidate functions for
dependend calls does not apply for template ids. This might be worth an
experiment, but there is a more general 'only declarations from the
definition context are considered' clause elsewhere, which kicks in e.g.
for qualified lookup, so chances are slim that this helps.
Ciao, Joerg
--
Joerg Barfurth Sun Microsystems - Desktop - Hamburg
>>>>>>>>>>>>>>>>>> using std::disclaimer <<<<<<<<<<<<<<<<<<<<<<<
Software Engineer [EMAIL PROTECTED]
OpenOffice.org Configuration http://util.openoffice.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]