From: SourceForge.net <no...@so...> - 2009-04-21 20:14:37
|
Bugs item #2753487, was opened at 2009-04-11 17:54 Message generated for change (Comment added) made by wsfulton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2753487&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: csharp Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Milo Yip (miloyip) >Assigned to: William Fulton (wsfulton) Summary: [C#] bool & OUTPUT typemap does not work Initial Comment: As shown in the following example, *jarg4 has not been initialized to zero, so writing to *arg4 can only write the first byte of *jarg4. If the other three bytes are non-zero initially, then after calling the wrapper in C# the bool parameter must be true, no matter what C++ side outputs. This is non-deterministic because *jarg4 is passed by interop and it is non-initailized. // in Runtime.i %include <typemaps.i> class Runtime { bool GetField(int object, const char* fieldName, bool& OUTPUT); }; // Runtime.cxx SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Runtime_GetField__SWIG_1(void * jarg1, int jarg2, char * jarg3, unsigned int * jarg4) { unsigned int jresult ; Mil::Script::Runtime *arg1 = (Mil::Script::Runtime *) 0 ; Mil::Script::Object arg2 ; char *arg3 = (char *) 0 ; bool *arg4 = 0 ; bool result; arg1 = (Mil::Script::Runtime *)jarg1; arg2 = (Mil::Script::Object)jarg2; arg3 = (char *)jarg3; arg4 = (bool *)jarg4; result = (bool)(arg1)->GetField(arg2,(char const *)arg3,*arg4); jresult = result; return jresult; } ---------------------------------------------------------------------- >Comment By: William Fulton (wsfulton) Date: 2009-04-21 20:14 Message: I can't replicate the bug, but agree there is a problem. Fixed for swig-1.3.40. Please wait for the new release or add in this typemap: %typemap(in) bool *OUTPUT, bool &OUTPUT %{ *$input = 0; $1 = ($1_ltype)$input; %} ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2753487&group_id=1645 |