omnetpp / cmake

CMake module for OMNeT++ projects
GNU General Public License v2.0
8 stars 5 forks source link

Undefined symbols when building INET (...on Windows) #5

Closed HpLightcorner closed 3 years ago

HpLightcorner commented 3 years ago

It seems that there are some symbols missing when building/linking with INET. For example, inet::DispatchProtocolReq. However, the corresponding.cc (ProtocolTag_m.cc) files seem to be compiled correctly.

HpLightcorner commented 3 years ago

It seems that only generated message code is affected. __declspec(dllexport) seems to be missing such that another program can link to this under windows.

HpLightcorner commented 3 years ago

Can be fixed by calling the message compiler with -P command. @riebl and @thor - do you think that we have to make the -P option Windows-specific or shall we introduce this fix as a general solution when generating messages?

riebl commented 3 years ago

INET's src/makefrag adds -DINET_EXPORT only for the Win32 platform. Maybe opp_cmake.py needs to handle the -pINET argument passed to opp_makemake in addition? The current implementation just skips this type of argument…

HpLightcorner commented 3 years ago

Hmmm, did not take a look at the python file till now... It seems that for all other symbols (where the source code is not generated) CMake handles the definition of INET_EXPORT by default. Furthermore, it seems that only OMNeT++ version 6 is affected? The message compiler from version 5 does not have this feature (or I have overseen it).

riebl commented 3 years ago

opp_msgc of OMNeT++ 5.6.2 also knows the -P option. I cannot say if something has changed regarding symbol handling, though.

HpLightcorner commented 3 years ago

yes, they are the same, just got misled by the flag option for -P which is pretty-print.