How to add a new XPCOM service baked into LibXUL?

Chris <[email protected]>
Newsgroups gmane.comp.mozilla.devel.embedding
Organization http://groups.google.com
Message-ID <713ddfd3-15d4-4784-ae1f-a7d10fb62ca2@x42g2000yqx.googlegroups.com>
Hi all,

I'm trying to create a new XPCOM service that must be accessible from
within LibXUL (specifically, from within the gfx module). So I'm
basically creating something as "low level" as "@mozilla.org/docshell;
1".

I'm using the config below, which doesn't seem to be working: My tree
compiles fine with the service is not visible from xpcshell when I
referenced it with contract ID (the interface is visible). (Yes, my
service is marked `scriptable`)

1. I am using this directory structure:

    gfx/my_xpcom/Makefile.in    (Just DIRS `public` and `src`)
    gfx/my_xpcom/public/Makefile.in
    gfx/my_xpcom/public/myService.idl
    gfx/my_xpcom/src/Makefile.in    (This file is attached below)
    gfx/my_xpcom/src/MyService.h
    gfx/my_xpcom/src/MyService.cpp
    gfx/my_xpcom/src/MyServiceFactory.cpp    (Mostly copied from xpcom/
sample)

2. I'm using these options for `src/Makefile.in`. These are mostly
written from intuitions and looking around other Makefile.in (Full
file is attached at the end)

    MODULE         = my_service
    LIBRARY_NAME   = my_service
    MODULE_NAME    = my_service
    EXPORT_LIBRARY = 1
    GRE_MODULE	= 1
    LIBXUL_LIBRARY = 1
    IS_COMPONENT	= 1
    FORCE_STATIC_LIB = 1

3. I also included `my_service` as a `COMPONENT_LIBS` in `toolkit/
library/libxul-config.mk`

Any help would be greatly appreciated!

Best regards,
Chris Yuen



===========



DEPTH		= ../../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk

MODULE         = my_service
LIBRARY_NAME   = my_service
MODULE_NAME    = my_service
EXPORT_LIBRARY = 1
GRE_MODULE	= 1
LIBXUL_LIBRARY = 1
IS_COMPONENT	= 1
FORCE_STATIC_LIB = 1

EXPORTS = MyService.h

CPPSRCS = \
  MyService.cpp \
  MyServiceFactory.cpp \
  $(NULL)

include $(topsrcdir)/config/rules.mk

EXTRA_DSO_LDOPTS += \
	$(XPCOM_LIBS) \
	$(MOZ_COMPONENT_LIBS) \
    $(NSPR_LIBS) \
    $(NULL)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.