Robert Jordan wrote:
> Vincent Finn wrote:
>> Hi,
>>
>> I am sure this is a stupid question but I wanted to check before going
>> down the wrong route.
>>
>> On windows I am passing IntPtrs from C# to C++ and them using
>> SysAllocString on "UnmanagedType.LPWStr" and CoTaskMemAlloc on structs
>> when I want to return memory.
>>
>> In Visual Studio I need to include "oleauto.h" to get those functions,
>> and I then need to include "windows.h" to get various #defines used in
>> "oleauto.h".
>>
>> "windows.h" won't be on a Linux machine so can someone confirm for me
>> that CoTaskMemAlloc is portable and not MS?
>>
>> If it isn't what is the alternative?
>
> Instead of p/invoking you should use the following methods
> that do the right thing regardless of the platform:
>
> System.Runtime.InteropServices.Marshal.AllocCoTaskMem
>
> and
>
> System.Runtime.InteropServices.Marshal.FreeCoTaskMem
>
> Robert
This is the C++ side of things I am talking about, I can't call them
from my C++ code.
Vin
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list