Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C++

A Simple XPCOM Tutorial

Rate me:
Please Sign up or sign in to vote.
4.93/5 (30 votes)
30 Jun 2010CPOL5 min read 150.9K   4K   45  
Step by step XPCOM creation and implementation in C++.
#include "Sample.h"

NS_IMPL_ISUPPORTS1(CSample, ISample)

CSample::CSample()
{
	/* member initializers and constructor code */
	NS_INIT_ISUPPORTS();
}

CSample::~CSample()
{
	/* destructor code */
}

/* long Add (in long a, in long b); */
NS_IMETHODIMP CSample::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval)
{
	//*_retval = a + b;
	*_retval = a + b;
	return NS_OK;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Eyeball Networks Inc, Dhaka
Bangladesh Bangladesh
I strongly believe, a person's strongest point is to know his/her weak point. I try to be simple.

I have completed BSc in Computer Science & Engineering from Shah Jalal University of Science & Technology, Sylhet, Bangladesh (SUST).


Watch out for my other CodeProject Articles.

Comments and Discussions