Introduction to rbXPCOM

Introduction to rbXPCOM

Sample Code

rbXPCOM allows a Ruby programmer both use and implement XPCOM object just like normal Ruby object. Following sample code illustrate 'use' part.

Suppose "@ruby/test/Test;1" supports following interface.

interface rbIXPCOMTest : nsISupports {
  const PRUint16 CONST = 1;
  string EchoString( in string s );

The, this component is used from Ruby like below.

require 'xpcom'
test = XPCOM.instance("@ruby/test/Test;1", "rbIXPCOMTest")

p XPCOM::rbIXPCOMTest::CONST        #=> 1

p test.EchoString("hello world")    #=> "hello world"


Currently, following features are available.

rbXPCOM still lacks following major features.