Unresolved symbols with /GL /LTCG



  • Hi,

    I wrote my first function using maxon::Result, works really well in Debug mode, but when I compile for Windows Release mode with /GL (implying /LTCG), I get some undefined symbols. If i disable /GL, it links successfully.

    [05:55:44][Link] SdkExample.obj error LNK2001: unresolved external symbol "public: struct maxon::ErrorInterface::MTable const & __cdecl maxon::Object::PrivateSuperMTable::GetMTable<class maxon::ErrorInterface>(void)const " (??$GetMTable@VErrorInterface@maxon@@@PrivateSuperMTable@Object@maxon@@QEBAAEBUMTable@ErrorInterface@2@XZ)
    [05:55:44][Link] SdkExample.obj error LNK2001: unresolved external symbol "public: class maxon::ComponentInfo const & __cdecl maxon::Object::GetComponentInfoOfSuper<class maxon::ErrorInterface::ReferenceFunctionsImpl<class maxon::Object::ReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::UnexpectedErrorInterface,class maxon::PointerHandler,void> > > > >(class maxon::ErrorInterface::ReferenceFunctionsImpl<class maxon::Object::ReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::UnexpectedErrorInterface,class maxon::PointerHandler,void> > > > const *,class maxon::PrivateOverloadRank0 *)const " (??$GetComponentInfoOfSuper@V?$ReferenceFunctionsImpl@V?$ReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@VUnexpectedErrorInterface@maxon@@VPointerHandler@2@X@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@maxon@@@Object@maxon@@QEBAAEBVComponentInfo@1@PEBV?$ReferenceFunctionsImpl@V?$ReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@VUnexpectedErrorInterface@maxon@@VPointerHandler@2@X@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@1@PEAVPrivateOverloadRank0@1@@Z)
    [05:55:44][Link] SdkExample.obj error LNK2001: unresolved external symbol "public: class maxon::ComponentInfo const & __cdecl maxon::Object::GetComponentInfoOfSuper<class maxon::ErrorInterface::ReferenceFunctionsImpl<class maxon::Object::ReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::NullptrErrorInterface,class maxon::PointerHandler,void> > > > >(class maxon::ErrorInterface::ReferenceFunctionsImpl<class maxon::Object::ReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::NullptrErrorInterface,class maxon::PointerHandler,void> > > > const *,class maxon::PrivateOverloadRank0 *)const " (??$GetComponentInfoOfSuper@V?$ReferenceFunctionsImpl@V?$ReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@VNullptrErrorInterface@maxon@@VPointerHandler@2@X@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@maxon@@@Object@maxon@@QEBAAEBVComponentInfo@1@PEBV?$ReferenceFunctionsImpl@V?$ReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@VNullptrErrorInterface@maxon@@VPointerHandler@2@X@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@1@PEAVPrivateOverloadRank0@1@@Z)
    [05:55:44][Link] SdkExample.obj error LNK2001: unresolved external symbol "public: class maxon::ComponentInfo const & __cdecl maxon::Object::GetComponentInfoOfSuper<class maxon::ErrorInterface::ReferenceFunctionsImpl<class maxon::Object::ReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::UnsupportedArgumentErrorInterface,class maxon::PointerHandler,void> > > > >(class maxon::ErrorInterface::ReferenceFunctionsImpl<class maxon::Object::ReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::UnsupportedArgumentErrorInterface,class maxon::PointerHandler,void> > > > const *,class maxon::PrivateOverloadRank0 *)const " (??$GetComponentInfoOfSuper@V?$ReferenceFunctionsImpl@V?$ReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@VUnsupportedArgumentErrorInterface@maxon@@VPointerHandler@2@X@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@maxon@@@Object@maxon@@QEBAAEBVComponentInfo@1@PEBV?$ReferenceFunctionsImpl@V?$ReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@VUnsupportedArgumentErrorInterface@maxon@@VPointerHandler@2@X@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@1@PEAVPrivateOverloadRank0@1@@Z)
    [05:55:44][Link] SdkExample.obj error LNK2001: unresolved external symbol "public: class maxon::ComponentInfo const & __cdecl maxon::Object::GetComponentInfoOfSuper<class maxon::ErrorInterface::ConstReferenceFunctionsImpl<class maxon::Object::COWReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::ErrorInterface const ,class maxon::StrongCOWRefHandler,class maxon::Error> > > > >(class maxon::ErrorInterface::ConstReferenceFunctionsImpl<class maxon::Object::COWReferenceFunctionsImpl<class maxon::RefBaseFunctions<class maxon::DirectRef<class maxon::ErrorInterface const ,class maxon::StrongCOWRefHandler,class maxon::Error> > > > const *,class maxon::PrivateOverloadRank0 *)const " (??$GetComponentInfoOfSuper@V?$ConstReferenceFunctionsImpl@V?$COWReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@$$CBVErrorInterface@maxon@@VStrongCOWRefHandler@2@VError@2@@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@maxon@@@Object@maxon@@QEBAAEBVComponentInfo@1@PEBV?$ConstReferenceFunctionsImpl@V?$COWReferenceFunctionsImpl@V?$RefBaseFunctions@V?$DirectRef@$$CBVErrorInterface@maxon@@VStrongCOWRefHandler@2@VError@2@@maxon@@@maxon@@@Object@maxon@@@ErrorInterface@1@PEAVPrivateOverloadRank0@1@@Z)
    

    Since we don't want to disable this optimization, we decided not to use maxon::Result for now, replaced it for a std::string returning the error message or empty on success.

    Is it safe to turn on /LTCG in the core.framework?
    How do you suggest we to do so without having to modify the generated project?


  • Global Moderator

    Hello,

    I got some feedback from the developers.

    It seems that these optimizations remove some needed constructors. So we cannot recommend to apply these optimizations. As far as we can see there is no way to use these optimizations.

    best wishes,
    Sebastian



  • 😞

    Do you know if we're going to hit the same wall with other APIs or is it just particular to Result?


  • Global Moderator

    Hello,

    I'm not aware of any other components that won't work with that optimization. But again, we don't use this optimization so I haven't tested that.

    best wishes,
    Sebastian