Rochet2 / TrinityCore

Rochet2's stuff for TC
https://rochet2.github.io
89 stars 144 forks source link

dressnpcs: CreatureDisplayInfoStore linker error with shared library builds #136

Closed ihm-tswow closed 2 years ago

ihm-tswow commented 3 years ago

Building TrinityCore (13f1a9f) merged with https://github.com/Rochet2/TrinityCore/tree/dressnpcs_3.3.5 with -DSCRIPTS=dynamic produces the following (msvc) linker error:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: struct CreatureDisplayInfoEntry const * __cdecl CreatureDisplayInfoStore::LookupEntry(unsigned int)const " (?LookupEntry@CreatureDisplayInfoStore@@QEBAPEBUCreatureDisplayInfoEntry@@I@Z) referenced in function "public: static bool __cdecl modify_commandscript::HandleModifyMountCommand(class ChatHandler *,char const *)" (?HandleModifyMountCommand@modify_commandscript@@SA_NPEAVChatHandler@@PEBD@Z)   scripts_commands    D:\temp\TrinityCoreBuild\src\server\scripts\cs_modify.obj   1   
Error   LNK2001 unresolved external symbol "public: struct CreatureDisplayInfoEntry const * __cdecl CreatureDisplayInfoStore::LookupEntry(unsigned int)const " (?LookupEntry@CreatureDisplayInfoStore@@QEBAPEBUCreatureDisplayInfoEntry@@I@Z)   scripts_commands    D:\temp\TrinityCoreBuild\src\server\scripts\cs_npc.obj  1   

The struct is in DBCStructure.h and the function in DBCStores.cpp. Usually it's enough to add TC_GAME_API to the struct so it exports the functions, but that doesn't seem to be enough here, and neither is moving the declaration to the other project. Leaving this issue here in case I don't find a solution any time soon.

For anyone looking for a workaround, the command lookups in cs_modify.cpp and cs_npc.cpp aren't critical, just comment out the calls to sCreatureDisplayInfoStore.LookupEntry

Rochet2 commented 2 years ago

Would be nice if you could test the fix. Otherwise, I will just merge it at some point after the CI tests pass.

Rochet2 commented 2 years ago

Decided to merge already. Tested locally that dynamic build succeeds. Comment or reopen if persists.