Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

build problem

1 view
Skip to first unread message

Sébastien Lorquet

unread,
Dec 30, 2009, 5:29:07 AM12/30/09
to dev-te...@lists.mozilla.org, dev-ext...@lists.mozilla.org
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

Sébastien Lorquet

unread,
Dec 30, 2009, 11:10:44 AM12/30/09
to dev-te...@lists.mozilla.org, dev-ext...@lists.mozilla.org
Replying to maybe help other people since google seems rather quick to index
threads of this mailing list.

Well, after a lot of browsing around blogs that indicated the same type of
problems, I managed to resolve this by
- defining XPCOM_GLUE and XPCOM_GLUE_USE_NSPR,
- then linking against xpcomglue_s, xpcom and nspr4 AND also plc4.

This was the combination of all this that permitted successful linking. I
had a long time finding the proper combination.

These mailing lists seem to be a veeeery low volume one, or is my problem so
basic no one bother to reply?

I'd like to know if what I did is the proper way to compile extensions or if
it just "happened to work".

Regards
Sebastien

John J. Barton

unread,
Dec 30, 2009, 11:35:36 AM12/30/09
to
Sébastien Lorquet wrote:
> Replying to maybe help other people since google seems rather quick to index
> threads of this mailing list.
>
> Well, after a lot of browsing around blogs that indicated the same type of
> problems, I managed to resolve this by
> - defining XPCOM_GLUE and XPCOM_GLUE_USE_NSPR,
> - then linking against xpcomglue_s, xpcom and nspr4 AND also plc4.
>
> This was the combination of all this that permitted successful linking. I
> had a long time finding the proper combination.
>
> These mailing lists seem to be a veeeery low volume one, or is my problem so
> basic no one bother to reply?

This list is mostly JS folks working on Firefox extensions. You may have
better luck with build questions on mozilla.dev.builds.

jjb

0 new messages