They are plenty fun once you get a hang of themroxaz wrote:i dont quite know how typemaps work, tried experimenting with them but without much success.
I actually did start out exactly how you suggested, however got invalid cast errors during compile time. Attempting to force (void *) or (char *) cast allowed compiling but caused runtime errors and seg faults. I understand the memory leaks resulting from my approach, however, it is only a stop gap measure to get things running.roxaz wrote:looking at your changes so far i see some memory leaks (unless swig does free up those objects, but i doubt it). for example in %typemap(out) path&. sure heap allocation is needed? i think i had typemaps that compile with stack allocation. also new char[$1->size()] does not include null terminator. doesnt something like $result = $1->c_str() work?
Agree with you on that as well. I'll revisit the -includeallheaders approach later again after getting the wrapper completed this way.roxaz wrote:and finally including headers one by one works, but like in previous case should new header be added it will require manual update of wrapper while with auto-includes new code would be wrapped automatically most of the time.