Page 1 of 1

Static Linking Issues

Posted: Fri Jun 28, 2013 07:45
by Wizzard
Hello,
I have encountered two separate problems with my initial attempt to use CEGUI 0.8.2.

1.) I am trying to build my project with CEGUI linked statically using TDM-GCC, a compiler suite derived from MinGW. However, I get the following error:

Code: Select all

libCEGUIBase-0_Static.a(Scheme.cpp.obj):Scheme.cpp:(.text+0x548): undefined reference to "getWindowFactoryModule"

Also, I noticed that the ONLY code in the project that has the string "getWindowFactoryModule" in it is in the following two segments of Scheme.cpp:

Code: Select all

#if defined(CEGUI_STATIC)
extern "C"
{
CEGUI::FactoryModule& getWindowRendererFactoryModule();
CEGUI::FactoryModule& getWindowFactoryModule();
}
#endif

Code: Select all

#if !defined(CEGUI_STATIC)
            // load dynamic module as required
            if (!(*cmod).dynamicModule)
                (*cmod).dynamicModule = CEGUI_NEW_AO DynamicModule((*cmod).name);

            FactoryModule& (*getWindowFactoryModuleFunc)() =
                reinterpret_cast<FactoryModule&(*)()>(
                    (*cmod).dynamicModule->
                        getSymbolAddress("getWindowFactoryModule"));

            if (!getWindowFactoryModuleFunc)
                CEGUI_THROW(InvalidRequestException(
                    "Required function export "
                    "'FactoryModule& ""getWindowFactoryModule()' "
                    "was not found in module '" + (*cmod).name + "'."));

            // get the WindowRendererModule object for this module.
            (*cmod).factoryModule = &getWindowFactoryModuleFunc();
#else
            (*cmod).factoryModule = &getWindowFactoryModule();
#endif

As far as I can see, getWindowFactoryModule is not something that comes in CEGUI. How do I define it?

2.) The following warnings are given by the compiler:

Code: Select all

PropertyHelper.h:329:42: warning: unknown conversion type character 'l' in format [-Wformat]
PropertyHelper.h:329:42: warning: too many arguments for format [-Wformat-extra-args]

PropertyHelper.h:337:49: warning: unknown conversion type character 'l' in format [-Wformat]
PropertyHelper.h:337:49: warning: too many arguments for format [-Wformat-extra-args]

I'm not sure if these are okay or not. They seem to be caused by the usage of %llu in snprintf.

Edit: I tested whether the code still performs as intended and it does.

Re: Static Linking Issues

Posted: Sun Jul 07, 2013 14:22
by mmatt
Hi Wizzard,
I've also been experimenting with static linking the development branch and discovered the same problem with getWindowFactoryModule. It used to be exported by cegui/include/CEGUI/CommonDialogs/Module.h, but was removed 6 weeks ago. There looks to be some fairly heavy refactoring going on...

I think you should be ok to comment out the undefined reference for now, it was only recently added anyway (since 0.7). I'm hoping it will be resolved at some point in the future.

Matt

Re: Static Linking Issues

Posted: Mon Jul 15, 2013 17:59
by DivideStudio
Hi Wizzard

You could try and define something like this in FactoryModule.cpp:

Code: Select all

extern "C"{
CEGUI::FactoryModule& getWindowFactoryModule()
{
    static CEGUI::FactoryModule mod;
    return mod;
}
}


Should work :)