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

Problems using nsHTMLAtoms

0 views
Skip to first unread message

Michael R

unread,
Apr 29, 2008, 9:35:12 AM4/29/08
to dev-pl...@lists.mozilla.org
Hi,

I'm writing an application which embeds mozilla.
In my C++ code I would like to use nsHTMLAtoms (from nsHTMLAtoms.h which is
exposed in .../dist/include/content)

The problem arises when I'm trying to link my executable.
I get all the atoms referenced in my code as unresolved symbols.
Linking with libgklayout.so is not a solution since these symbols are not
exposed in non debug mode.

Please suggest what to do.

Thanks,
-Michael.

L. David Baron

unread,
Apr 29, 2008, 11:24:52 AM4/29/08
to Michael R, dev-pl...@lists.mozilla.org

You shouldn't use nsHTMLAtoms. Instead, you should call NS_NewAtom,
do_GetAtom, or equivalent to get the atom for the same string. The
atom table will ensure that you are given the same atom object
(which, after all, is the point of atoms). Depending on whether
you're linking against XPCOM, you want to use either the methods in
nsIAtom.idl (if you are) or nsIAtomService.idl (if you aren't).

-David

--
L. David Baron http://dbaron.org/
Mozilla Corporation http://www.mozilla.com/

Michael R

unread,
Apr 29, 2008, 11:37:23 AM4/29/08
to Michael R, dev-pl...@lists.mozilla.org
Thanks a lot for the reply David!
If so, then why is nsHTMLAtoms.h exposed in the mozilla header directory ?

Actually, I gave the HTML atoms as an example.
I would like to understand how I can use the internal API of mozilla when
embeding it ?
I see that the libraries in .../dist/bin/components are not exposing those
symbols (libgklayout.so is a good example)
MOZILLA_INTERNAL_API flag doesn't help.

Thanks,
Michael.

Neil

unread,
Apr 29, 2008, 11:44:58 AM4/29/08
to
Michael R wrote:

>why is nsHTMLAtoms.h exposed in the mozilla header directory ?
>
>

Because it's used to compile mozilla. Ideally you should be looking in
the SDK directory instead, but I guess none of the atom functions are
exposed there, so your next stop should be the idl directory.

--
Warning: May contain traces of nuts.

L. David Baron

unread,
Apr 29, 2008, 11:52:21 AM4/29/08
to Michael R, dev-pl...@lists.mozilla.org
On Tuesday 2008-04-29 18:37 +0300, Michael R wrote:
> If so, then why is nsHTMLAtoms.h exposed in the mozilla header directory ?

Perhaps that's a mistake.

> Actually, I gave the HTML atoms as an example.
> I would like to understand how I can use the internal API of mozilla when
> embeding it ?

I'm not sure how to answer that question in general. I think it
depends on the API.

0 new messages