Hi,
Following the official steps, I want to get xpcom-based dll, but I did not link successfully, the belows is the error.
1>xpcomglue_s_nomozalloc.lib(nsISupportsImpl.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in FpComponent.obj
I use Gecko18 for Firefox 17 and my project use VS2010 IDE, the below shows the project settings:
1. At the input of Linker, I put mozalloc.lib; nspr4.lib; plds4.lib; plc4.lib; xpcomglue_s_nomozalloc.lib; xpcom.lib in the additional depencies
2. At the preprocessor of C/C++, I added XP_WIN32 and XP_WIN to the Preprocessor Definitions
3. At the code generation, I selected Mulit-thread Debug DLL(/MDd) at Runtime Library
4. At the VC++ Direcories, I set the Include Directories and Library Directories
I give the main part of code, hope anyone can show me some suggestions
/******************************************************************
** FpComponent.h
*******************************************************************/
#pragma once
#ifndef _FP_COMPONENT_H_
#define _FP_COMPONENT_H_
#include "IFpComponent.h"
#define FUNPLAYER_COMPONENT_CONTRACTID "@funshion.com/fpcomponent;1"
#define FUNPLAYER_COMPONENT_CLASSNAME "Funshion player's XPCOM"
#define FUNPLAYER_COMPONENT_CID { 0xedee1598, 0xaa95, 0x4325, { 0xa3, 0x25, 0xc5, 0x64, 0x3c, 0x50, 0xcc, 0x3e } }
class CFpComponent : public IFpComponent
{
public:
CFpComponent(void);
~CFpComponent(void);
NS_DECL_ISUPPORTS
NS_DECL_IFPCOMPONENT
};
#endif
/******************************************************************
** FpComponent.cpp
*******************************************************************/
#include "stdafx.h"
#include "FpComponent.h"
CFpComponent::CFpComponent( void )
{}
CFpComponent::~CFpComponent( void )
{}
NS_IMPL_ISUPPORTS1(CFpComponent, IFpComponent)
NS_IMETHODIMP CFpComponent::Startup( void )
{
MessageBoxA(NULL, "Hello World!", "tip", NULL);
return NS_OK;
}
The Question is: how can I get the correct xpcom, and how can I get valid instance when calling Components.classes["@fpcomponet.com/fpcomponent;1"].createInstance();
Thanks.