Hi I have an XPCOM component which I'm now converting to use ctypes.
I was able to create functions that take a wchar_t* and I define the functions using ctypes.jschar.ptr. This all works great, but how do I use output parameters when I need to create wchar_t pointers and array of pointers?
I have done a lot of reading and I'm confused.
- How should I allocate the memory inside my C dll? should I use malloc? if so how would that get freed up?
- How would you allocate and handle an out parameter of wchar_t * ? would I pass it in from javascript as a CData I declate before?
- How should I handle a wchar_t string array?
Can anyone give me some code examples of say how to handle a function like this? (both on the C side of things, using malloc? or what should I use to allcoate the memory and on the javascript side, how this should be handled)?
int MyFunc(wchar_t** outString, wchar_t*** outStringArray)
Thanks!