hi,
I am trying to send a string from my C++ XPCOM component to _javascript_ code.
My Component code is something like below:
NS_IMETHODIMP MyComponent::GetName( PRUnichar **_retval)
{
std::wstring name = _T("MyName");
*_retval = (wchar_t*) nsMemory::Alloc(wcslen(name.c_str()) + 1);
if (! *_retval)
return NS_ERROR_NULL_POINTER;
wcscpy(*_retval,name.c_str());
return NS_OK;
}
The _javascript_ is calling the component as below
var name;
name = CompObj.GetName();
Firefox crashes evertime because of a memory access violation.
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?
Sorry in case this sounds like a very basic question. I have just started working with Firefox components
Thanks in advance,
Gautam
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
