build problem

Sébastien Lorquet <[email protected]> Wed, 30 Dec 2009 11:29:07 +0100
Newsgroups gmane.comp.mozilla.devel.nspr
Message-ID <[email protected]>
Hi,

I am new to these lists so I don't know if my problem is related to the nspr
mailing list or the extensions mailing list. I'll choose one in the next
posts.

I have made an xpcom object to be bundled in a firefox extension to expose
new DOM Javascripts objects.
I used the mozilla code base from mxr as a reference.

So far, I have resolved all issues related to the extension itself, the
individual cpp files are compiling fine.

However, I have a link time problem.

The macro NS_DOMCI_EXTENSION_ENTRY_BEGIN defined in nsIDOMClassInfo.h relies
on nsCRT::strcmp from nsCRT.h

This symbol is not defined a link time.


#define NS_DOMCI_EXTENSION_ENTRY_BEGIN(_class)          \
  if (nsCRT::strcmp(aName, #_class) == 0) {       \
    static const nsIID* interfaces[] = {

I'm using xulrunner-sdk from
http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.9.0.16/sdk/,
or alternatively the 1.9.1.4 version, the behaviour is the same with both.

I'm compiling on windows XP using visual studio express 2009 and codeblocks
as IDE, and I'm not relying on the mozilla build system.
The failing link command line is:

link.exe /dll /nologo /LIBPATH:"C:\Program Files\Microsoft
SDKs\Windows\v6.0A\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio
9.0\VC\lib"  /out:Debug\myextension.dll user32.lib
C:\programs\xulrunner-sdk-1.9.1.4\sdk\lib\*xpcomglue_s*.lib
C:\programs\xulrunner-sdk-1.9.1.4\sdk\lib\*xpcom*.lib
C:\programs\xulrunner-sdk-1.9.1.4\sdk\lib\*nspr4*.lib  Debug\obj\object1.obj
Debug\obj\log.obj Debug\obj\main.obj Debug\obj\object2.obj   /DEBUG

   Creating library Debug\myextension.lib and object Debug\ myextension.exp

main.obj : error LNK2019: unresolved external symbol *"__declspec(dllimport)
public: static int __cdecl nsCRT::strcmp(char const *,char const
*)"*(__imp_?strcmp@nsCRT
@@SAHPBD0@Z) referenced in function "public: virtual unsigned int __stdcall
nsmydomciDOMCIExtension::RegisterDOMCI(char const *,class
nsIDOMScriptObjectFactory *)"

So I have questions
- do I use the correct version of the sdk?
- do I use the correct "linkage"?
- do I use the correct static libs on the command line?

My main.cpp file includes the following:
#include "xpcom-config.h"
#include "nsXPCOM.h"
#include "nsIGenericFactory.h"
#include "nsIDOMClassInfo.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsCRT.h"
#include "nsICategoryManager.h"
#include "nsServiceManagerUtils.h" //do_getservice
#include "nsIScriptNameSpaceManager.h" // JAVASCRIPT_DOM_CLASS

Did I use forbidden things? do I lack wrappers or something required?

Regards and thanks for any help
Sebastien