open-dis / open-dis-cpp

C++ implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v6 and v7
BSD 2-Clause "Simplified" License
91 stars 66 forks source link

missing EXPORT_MACRO with PduBank #50

Closed shadow88s closed 3 years ago

shadow88s commented 3 years ago

add EXPORT_MACRO to PduBank

leif81 commented 3 years ago

Thank-you for contribution @shadow88s

Could you describe the change? I'm not familiar with what this change does.

shadow88s commented 3 years ago

Thank-you for contribution @shadow88s

Could you describe the change? I'm not familiar with what this change does.

This change exports the class from the DLL. Without this export, the Linker cannot find the class symbol in the object file and I run into a lnk2019 unresolved external symbol __declspec(dllimport) error.

According to microsft documents, "declspec(dllexport) stores function names in the DLL's export table. When building your DLL, you typically create a header file that contains the function prototypes and/or classes you are exporting and add declspec(dllexport) to the declarations in the header file. To make your code more readable, define a macro for __declspec(dllexport) and use the macro with each symbol you are exporting:"

https://docs.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-declspec-dllexport?view=msvc-160