Here's a copy of the problem.
[quote name='Pi Masta' date='Dec 17 2006, 11:42 AM' post='162376']
Ok, I mentioned this to reist, and probably confusingly as well. (Also doesn't help that this only affects Windows and he cannot test this himself) I think I found out why the dependencies are not compiling on my machine (and Xenocide with it). It is due to a little mundane addition to the 'CEGUIRefCounted.h' file, making its class 'export' to the DLL. They actually made this update in version 0.5 of CEGUI, however, it got overlooked when updating CEGUI in the dependencies until recently (revision 1499).
Let me explain what happens. The 'RefCounted' class is merely a template that seems to work as a shared pointer. Before it was just a normal class with the template argument. Our CEGUIPython uses this file and its template. (It is a useful utility class, but it should not specific to CEGUI or CEGUIPython). After the update it was given the 'CEGUIEXPORT' macro prefix which is defined in CEGUIBase.h:
Code: Select all
/*************************************************************************
Dynamic Library import / export control conditional
(Define CEGUIBASE_EXPORTS to export symbols, else they are imported)
*************************************************************************/
#if defined( __WIN32__ ) || defined( _WIN32 )
# ifdef CEGUIBASE_EXPORTS
# define CEGUIEXPORT __declspec(dllexport)
# else
# define CEGUIEXPORT __declspec(dllimport)
# endif
# define CEGUIPRIVATE
#else
# define CEGUIEXPORT
# define CEGUIPRIVATE
#endif
Nothing too big here, a lot of the classes in CEGUI use this macro to allow them to be imported when called outside of the project and exported when building CEGUI (CEGUIBase has CEGUIBASE_EXPORTS defined on the command line). I'm assuming that CEGUI added it to the RefCounted template so that we can access the other classes RefCounted methods.
However here is where the problem lies in. Take a look at CEGUIPythonFunctor.h (well the important parts for my point):
Code: Select all
#include "CEGUIRefCOunted.h"
namespace CEGUI
{
class PythonWrapper
{
// code here
};
class PythonFunctor
{
// code, methods and stuff
private:
RefCounted<PythonCallbackWrapper> pythonCallback;
};
} // namespace
Now then, since CEGUIBASE_EXPORTS isn't defined in our project (which it shouldnt), the macro CEGUIEXPORT gets replaced with __declspec(dllimport). So when the compiler goes to link the pythonCallback with CEGUI's RefCounted, it goes to the CEGUIBase_d.dll and tries to look up the code for RefCounted<PythonCallbackWrapper> class (So that it can call it through the DLL).
See the problem? The DLL doesn't have this class, (RefCounted is in a header it's never compiled directly as it is a template). Furthermore the DLL has no idea what a PythonCallbackWrapper is, that is defined in our project.
Now, why hasn't this cropped up on anyone else yet?
- This affects windows only, you can see from the macro's definition that if it is not compiled on Windows, it gets defined to nothing
- I'm guessing that nobody using windows has rebuilt the Dependencies lately, they should get this error as well
- Everything still works for the Windows users (remember when they rebuilt the dependencies for CEGUI at 0.5 release, RefCounted wasn't updated), so nobody has bothered to rebuild the dependencies
- CEGUIPython is really the only Add-on for CEGUI AFAIK, I don't think anybody tries to use their RefCounted class like we are trying to.
[/quote]