Fix LNK2005 linker error on Windows for fill_py_event template

For unknown reason after spliting the code in cppTango we start to get fatal error LNK1169: one or more multiply defined symbols found for PyEventCallBack::fill_py_event

The reason is that the declare template in callback.h, and provide the specialization for Tango::EventData in callback.cpp. But when compiling device_proxy.cpp, the compiler doesn't know about the specialization in callback.cpp, so it instantiates the primary template. Then when linking, both device_proxy.obj and callback.obj contain a definition of fill_py_event<Tango::EventData>. Somehow GCC/Clang lives with this, but MSVC is stricter about One Definition Rule (ODR) violations and do not like it.

Why this was working before - no clue.

So I added explicit specialization declaration for PyEventCallBack::fill_py_eventTango::EventData in the header file.

Edited by Yury Matveev

Merge request reports

Loading