开发者

What lib in the gecko 1.9.3 SDK do I link against to use moz_xmalloc()?

开发者 https://www.devze.com 2022-12-23 17:40 出处:网络
I\'m trying to link my XPCOM extension against the 1.9.3a3pre SDK and I get the following: error LNK2001: unresolved external symbol _moz_xmalloc

I'm trying to link my XPCOM extension against the 1.9.3a3pre SDK and I get the following:

error LNK2001: unresolved external symbol _moz_xmalloc

So, what lib do I need to link to? The documentation doesn't 开发者_如何学Csay.

This is on Windows right now, but I'll need it to build on Mac and Linux (32bit/64bit) as well.

Edit: Now with bounty.

Edit: Update: Turns out FF3.7 was cancelled. So I don't have to worry about this until FF4.


I have same error, and linking to mozalloc helps for that.


define 'XPCOM_GLUE' in C++ Preprocessor Definition property. It will fix the linking error.


Try defining MOZ_NO_MOZALLOC when compiling your extension, you will then get a DLL that uses your CRT's allocators. (Don't forget to use the NS_* allocators for XPCOM-compatible memory.)


  1. Add MOZ_NO_MOZALLOC in C++->Preprocessor->Definition property.

  2. Use xpcomglue_s_nomozalloc.lib instead of xpcomglue_s.lib in Linker->Input->Additional Dependencies

It will be OK!


reminder note: another option that can cause this even though everything else seems to be configured correctly in the project, is pointing at the wrong libs folder - such as 32 bit version for a 64 bit build.

edit v40 mozalloc.lib has changed name to mozglue.lib and has some additional methods.

edit v41 mozglue.lib has changed name to mozcrt.lib

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号