Gautam Bhagra wrote:
       wcscpy(*_retval,name.c_str());

Hm... which operating system are you using? PRUnichar strings use 2-byte units; wchar_t uses 4 bytes on many platforms. Getting this wrong may well crash.

Oh, just noticed this... the real problem is here:
       *_retval = (wchar_t*) nsMemory::Alloc(wcslen(name.c_str()) + 1);

You need to allocate 2 bytes for each character. Multiply that length by two (or by sizeof(PRUnichar)).

  Is there a special global memory that i am supposed to allocate my output 
string to which remains the same between calls from C++ and JS?

You are doing this correctly (by using nsMemory).

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to