diff --git a/library/DataIdentity.cpp b/library/DataIdentity.cpp index 767724931..c041b009d 100644 --- a/library/DataIdentity.cpp +++ b/library/DataIdentity.cpp @@ -47,7 +47,6 @@ namespace df { STL_OPAQUE_IDENTITY_TRAITS(condition_variable); STL_OPAQUE_IDENTITY_TRAITS(fstream); STL_OPAQUE_IDENTITY_TRAITS(mutex); - STL_OPAQUE_IDENTITY_TRAITS(shared_ptr); STL_OPAQUE_IDENTITY_TRAITS(future); STL_OPAQUE_IDENTITY_TRAITS(function); STL_OPAQUE_IDENTITY_TRAITS(optional >); diff --git a/library/include/DataIdentity.h b/library/include/DataIdentity.h index 05df82e79..035f59d4b 100644 --- a/library/include/DataIdentity.h +++ b/library/include/DataIdentity.h @@ -40,10 +40,6 @@ namespace std { class mutex; }; -namespace df { - struct widget; -} - /* * Definitions of DFHack namespace structs used by generated headers. */ @@ -579,10 +575,21 @@ namespace df OPAQUE_IDENTITY_TRAITS(std::fstream); OPAQUE_IDENTITY_TRAITS(std::mutex); OPAQUE_IDENTITY_TRAITS(std::future); - OPAQUE_IDENTITY_TRAITS(std::shared_ptr); OPAQUE_IDENTITY_TRAITS(std::function); OPAQUE_IDENTITY_TRAITS(std::optional >); +#ifdef BUILD_DFHACK_LIB + template + struct DFHACK_EXPORT identity_traits> { + static opaque_identity *get() { + typedef std::shared_ptr type; + static std::string name = std::string("shared_ptr<") + typeid(T).name() + ">"; + static opaque_identity identity(sizeof(type), allocator_noassign_fn, name); + return &identity; + } + }; +#endif + template<> struct DFHACK_EXPORT identity_traits { static bool_identity identity; static bool_identity *get() { return &identity; }