Skip to content

Commit

Permalink
use public access modifier for mscv correct linkage.
Browse files Browse the repository at this point in the history
private static fileds are mangled as C and public static fields are mangled as S on MSVC. since fields with no access modifeiers in C++ classes are private by default, it affects the mangling of the fields on windows so need for public there
also fields that are private on the D side should match on C++ side. Posix doesn't really care about those but msvc does.

match private with private for msvc
  • Loading branch information
Emmanuel Nyarko authored and Emmanuel Nyarko committed May 24, 2024
1 parent b028f71 commit 435504c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions extras/AssociativeContainers/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
template <typename K, typename V>
class Map
{
static Map<K,V>* make() {return new Map<K, V>(); }

void insertOrAssign(const K& key, const V& value)
{
this->map.insert_or_assign(key, value);
}

std::map<K, V> map;

public: // msvc mangles public and private static fields differently so need for public
static Map<K,V>* make() {return new Map<K, V>(); }

};

0 comments on commit 435504c

Please sign in to comment.