From: Collin A. <co...@gm...> - 2011-03-22 02:53:36
|
In the library I'm wrapping, pointer types are used effectively as out parameters. I'd like to construct a typemap that so that wrapping this C++ signature: bool Func(bool* pVal) looks like this in C#: bool Func(out bool val) rather than the existing: Func(SWIGTYPE_p_bool val) I've read through the documentation I found here http://www.swig.org/Doc1.3/CSharp.html#csharp_memory_management_member_variables but the examples given are more complex, and I haven't been able to simplify them successfully to fit my needs. So far I've tried the following: %typemap(cstype) bool* "out bool" This gives me the correct signature in C#, but does not compile as the generated code comes out like so: public virtual bool Func(out bool pbVal) { bool ret = NativePINVOKE.Func(swigCPtr, SWIGTYPE_p_bool.getCPtr(pbVal)); return ret; } error CS1503: Argument 1: cannot convert from 'bool' to 'SWIGTYPE_p_bool' Any advice on what I'm missing here to solve this problem? Thanks, --Collin |