What lib in the gecko 1.9.3 SDK do I link against

2019-07-11 18:13发布

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 say.

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.

5条回答
放我归山
2楼-- · 2019-07-11 19:05

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

查看更多
再贱就再见
3楼-- · 2019-07-11 19:06

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.)

查看更多
够拽才男人
4楼-- · 2019-07-11 19:07
  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!

查看更多
beautiful°
5楼-- · 2019-07-11 19:10

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

查看更多
爷、活的狠高调
6楼-- · 2019-07-11 19:14

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

查看更多
登录 后发表回答