Patrick Hartling wrote:
Marcus Lindblom wrote:
Patrick Hartling wrote:
I have made some big progress in getting PyOpenSG updated to the OpenSG
2.0 trunk, but I have run up against problems related to class templates
with static data members.
[snip]
My hope is that this can be fixed
with a GCC compiler option or something that is similarly non-invasive
to the OpenSG code in question. Does anyone have any ideas or
suggestions about how this can be resolved?
Have you tried the python-c++ list? It's hard to think you're the first
one to encounter this.
Just offer something: On Windows, you can tell the compiler that a
certain template instantiation is to be exported from a dynamic library.
I don't know if something similar is possible with GCC, but I've heard
rumours lately about explicit export and automatic hiding there.
No, I hadn't asked there yet. I was just about to send them a message when I
tried something that seems to resolve things in a fairly clean manner. If I
modify the class declaration to be the following, things appear to be
working for me:
template<typename T>
class C
{
public:
// Leave initialization here.
static const int static_member = 0;
};
// Add static data member definition statement;
template<typename T> const int C<T>::static_member;
If I hadn't been so focused on the full type instantiation, I might have
tried this sooner. I am running a build right now to test this.
The attached patch fixes up the problem that I was seeing. There are
probably going to be other cases that I discover while working through the
load-time errors. Is this change acceptable?
-Patrick
--
Patrick L. Hartling
Senior Software Engineer, Priority 5
http://www.priority5.com/
The information transmitted in this communication is intended only for
the person or entity to which it is addressed and contains proprietary
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please destroy any copies, contact the sender
and delete the material from any computer.
Index: Source/Base/FieldContainer/Mixins/OSGStageHandlerMixin.inl
===================================================================
--- Source/Base/FieldContainer/Mixins/OSGStageHandlerMixin.inl (revision 1732)
+++ Source/Base/FieldContainer/Mixins/OSGStageHandlerMixin.inl (working copy)
@@ -38,6 +38,15 @@
OSG_BEGIN_NAMESPACE
+OSG_RC_FIELD_TMPL_DEF (template<class ParentT>,
+ StageHandlerMixin<ParentT>, UpdateMode );
+OSG_RC_FIELD_TMPL_DEF (template<class ParentT>,
+ StageHandlerMixin<ParentT>, RequestRun );
+OSG_RC_FIELD_TMPL_DEF (template<class ParentT>,
+ StageHandlerMixin<ParentT>, DestroyedFunctors);
+OSG_RC_LAST_FIELD_TMPL_DEF(template<class ParentT>,
+ StageHandlerMixin<ParentT> );
+
template <class ParentT> inline
void StageHandlerMixin<ParentT>::classDescInserter(TypeObject &oType)
{
Index: Source/Base/FieldContainer/Base/OSGReflexiveContainer.h
===================================================================
--- Source/Base/FieldContainer/Base/OSGReflexiveContainer.h (revision 1732)
+++ Source/Base/FieldContainer/Base/OSGReflexiveContainer.h (working copy)
@@ -393,6 +393,18 @@
#define OSG_RC_FIELD_DESC(OSG_FIELDNAME) \
OSG_FIELDNAME##FieldId, OSG_FIELDNAME##FieldMask
+#define OSG_RC_FIELD_TMPL_DEF(OSG_TMPLDECL, OSG_CLASSNAME, OSG_ELEMNAME) \
+ OSG_TMPLDECL const OSG::UInt32 OSG_CLASSNAME::OSG_ELEMNAME##FieldId; \
+ OSG_TMPLDECL const OSG::BitVector OSG_CLASSNAME::OSG_ELEMNAME##FieldMask
+
+#define OSG_RC_LAST_FIELD_TMPL_DEF(OSG_TMPLDECL, OSG_CLASSNAME) \
+ OSG_TMPLDECL const OSG::UInt32 OSG_CLASSNAME::NextFieldId; \
+ OSG_TMPLDECL const OSG::BitVector OSG_CLASSNAME::NextFieldMask
+
+#define OSG_RC_NO_FIELD_TMPL_DEF(OSG_TMPLDECL, OSG_CLASSNAME) \
+ OSG_TMPLDECL const OSG::UInt32 OSG_CLASSNAME::NextFieldId; \
+ OSG_TMPLDECL const OSG::BitVector OSG_CLASSNAME::NextFieldMask
+
OSG_END_NAMESPACE
#include "OSGFieldDescriptionBase.h"
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users