Skip to content
Snippets Groups Projects
Commit 7f5ccbb7 authored by David Dormagen's avatar David Dormagen
Browse files

added some more required DLL exports for external trackers

Note the disabled warning in TrackedObject. Otherwise, the whole STL container needs to be exported to the DLL, which is very problematic for a std::map.
Just disabling the warning works in this case, because the member is private and can not be accessed directly from outside of the DLL anyway.

For more info on this, see https://support.microsoft.com/en-us/kb/168958
parent d231f0bd
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include <cereal/cereal.hpp> #include <cereal/cereal.hpp>
#include <cereal/access.hpp> #include <cereal/access.hpp>
#include "util/platform.h"
namespace BioTracker { namespace BioTracker {
namespace Core { namespace Core {
...@@ -10,7 +12,7 @@ namespace Core { ...@@ -10,7 +12,7 @@ namespace Core {
* class representing the object/animal * class representing the object/animal
* which is to be tracked * which is to be tracked
*/ */
class ObjectModel { class BIOTRACKER_DLLEXPORT ObjectModel {
public: public:
virtual ~ObjectModel() = 0; virtual ~ObjectModel() = 0;
}; };
......
...@@ -11,13 +11,14 @@ ...@@ -11,13 +11,14 @@
#include <cereal/types/map.hpp> #include <cereal/types/map.hpp>
#include <cereal/types/vector.hpp> #include <cereal/types/vector.hpp>
#include "util/platform.h"
#include "ObjectModel.h" #include "ObjectModel.h"
#include "types.hpp" #include "types.hpp"
namespace BioTracker { namespace BioTracker {
namespace Core { namespace Core {
class TrackedObject { class BIOTRACKER_DLLEXPORT TrackedObject {
public: public:
TrackedObject(size_t id); TrackedObject(size_t id);
//TODO: check if default ctor is really necessary for cereal //TODO: check if default ctor is really necessary for cereal
...@@ -73,8 +74,17 @@ class TrackedObject { ...@@ -73,8 +74,17 @@ class TrackedObject {
private: private:
size_t _id; size_t _id;
size_t m_maximumFrameNumber; size_t m_maximumFrameNumber;
std::map<size_t, std::shared_ptr<ObjectModel>> _objectsByFrame;
#ifdef _MSC_VER
// Disable DLL export warning for this member. This is only possible
// because the member is private and can not be accessed directly when using the DLL anyway.
# pragma warning( push )
# pragma warning( disable: 4251 )
#endif
std::map<size_t, std::shared_ptr<ObjectModel>> _objectsByFrame ;
#ifdef _MSC_VER
# pragma warning( pop )
#endif
friend class cereal::access; friend class cereal::access;
template <class Archive> template <class Archive>
void serialize(Archive &ar) { void serialize(Archive &ar) {
......
...@@ -6,8 +6,10 @@ This macro must be used to mark all symbols that should be exported to a DLL. ...@@ -6,8 +6,10 @@ This macro must be used to mark all symbols that should be exported to a DLL.
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef BUILD_BIOTRACKER_DLL #ifdef BUILD_BIOTRACKER_DLL
#define BIOTRACKER_DLLEXPORT __declspec(dllexport) #define BIOTRACKER_DLLEXPORT __declspec(dllexport)
#define BIOTRACKER_EXPIMP_TEMPLATE
#else #else
#define BIOTRACKER_DLLEXPORT __declspec(dllimport) #define BIOTRACKER_DLLEXPORT __declspec(dllimport)
#define BIOTRACKER_EXPIMP_TEMPLATE extern
#endif #endif
#else #else
#define BIOTRACKER_DLLEXPORT #define BIOTRACKER_DLLEXPORT
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment