You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to have my C++ dll return a string to .NET core 2.0 wrapper. I want .NET to free up string when appropriate, and not have to make explicit call back to C++ to deallocate string. I've been able to do this successfully if I use CoTaskMemAlloc() (in Windows) to allocate the memory for string on C++ side but CoTaskMemAlloc is not supported in Linux. Windows C++ solution with CoTaskMemAlloc:
Activity
jkotas commentedon Jul 23, 2018
Forward CoTaskMemAlloc/Free to a regular malloc/free on non-Windows. E.g. it is what the interop tests do: https://github.com/dotnet/coreclr/blob/fa6222d52a81c24077206cf5082b2f3967e67ebc/tests/src/Common/Platform/platformdefines.h#L139
AaronRobinsonMSFT commentedon Jul 23, 2018
@jkotas is right. He pointed out the global test definition. In the Interop test directory itself we have also defined it explcitly:
https://github.com/dotnet/coreclr/blob/fa6222d52a81c24077206cf5082b2f3967e67ebc/tests/src/Interop/common/xplatform.h#L119
AaronRobinsonMSFT commentedon Jul 23, 2018
@MattWorkWeb I have created an issue for documenting or creating an example for this. See dotnet/coreclr#19090.
AaronRobinsonMSFT commentedon Jul 23, 2018
Moved to dotnet/docs#6629
Forward CoTaskMemAlloc/Free to a regular malloc/free
feat: Linux Support (#28)