First if all thanks for the willing to help.
Cgo is the built-in tool in go of building c libraries (see: https://golang.org/cmd/cgo/)
What I basically do is that I have a go code, which i build into c library (dll), i.e, i insert the go code onto the cgo mechine then get .h and .dll on the otherside.
The memory is allocated inside the .dll using C.malloc (which is basically c malloc), and i try to free it inside the cpp file which is linked to this dll.
If i build a function inside the go code to free a recived pointer, which will end up in the dll, then the problem is avoided.
That being said, due to the fact that I have quite a few callbacks and a large data transfer between the dll and my app i would like to keep it simple and not have to use a third function to free the mallocs, as it is also a problem if it happens the other way around, i.e., if i allocate memory in the app and try to free it inside the library.
Sorry if im unclear i tried to explsin it the best as i can.
Ps yes i do use windiws, a side remark is that if i use gcc this does not happen.
Anyway, is there anyway to use cgo with msvc? I actually run the cgo command from msvc cmd assuming the c part will be compiled with msvc.
In addition as far as i know you can actually do that with visual studio if you put the /md (multi threading) flag on.
Thanks for the info, guess i will have to find a way around it then. At least i now know there is no real way to do what i wanted so that close this door :)
Yes, i will probably go with the first option :) feel a bit massy but it is probably the better way to go... Plus in my case probably the only way hahaha.
Thanks a lot for helping.