I'm trying to pass a Unordered_Map from Cpp to GoLang. I have currently created a dll from GoLang which contains a method which accepts a Map as input and initialize it. My assumption is that in GoLang Map is passed as reference so I'm not returning anything.
//GoLang CODE
func InitializeMap(m map[*C.char]*C.char) {
ctr1 := C.CString("Anand")
ctr2 := C.CString("1")
m[ctr1] = ctr2 // Memory error is pointing at this line.
}
// CPP
std::unordered_map<char *,char *> mapInstance;
InitializeMap(&mapInstance);
// Header
typedef void *GoMap;
extern void InitializeMap(GoMap p0);
The error thrown is :
unexpected fault address 0x18dda4d0080 fatal error: fault [signal 0xc0000005 code=0x0 addr=0x18dda4d0080 pc=0x6de902e3]
Please Help me in right direction.
User contributions licensed under CC BY-SA 3.0