R�my Deslignes wrote:

Hi,

I am now facing a strange problem within a plugin / service code:

- platform = MS WINDOWS
- Mozilla 1.7.5

void* data = nsMemory::Alloc(10);

returns NULL

and

char* char_str = "How now brown cow?";
nsEmbedCString str(char_str);
std::cout << "length = " << str.Length() << std::endl ;

displays 0.

It is to say that :
- this code is called from Javascript,
- this code is in a DLL upon which both my plugin and my service are linked.
- this code USED to work when it was a part of the service


I am linking against xpcomglue.lib, using only SDK libs and includes.

Anyone has an idea ?

Thanks


nsMemory::Alloc is used by nsEmbedCString when it needs to heap allocate. I wonder, is it possible that you are trying to call nsMemory::Alloc before the XPCOM glue library has been initialized?

NOTE: Assuming you are writing a XPCOM component, then if you are using nsIGenericFactory, the XPCOM glue will be automatically initialized for you, but if you are not using the standard generic factory stuff, then you may have to initialize it manually. In that case, the method you need to call is XPCOMGlueStartup.

-Darin
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to