SAX/C++: GCJ and CNI

David Brownell david-b at pacbell.net
Tue Dec 28 22:17:07 GMT 1999


I've not been closely following this discussion, but I don't think
that one interesting point got raised yet.

That point being that a side effect of the "GNU Compiler for Java"
(GCJ -- see http://sourceware.cygnus.com) such a binding is more or
less defined automatically from the Java binding.  For some folk this
may suffice ... there _will_ be multiple SAX/C++ bindings.

Look at the GCJ and LIBGCJ pages for more information if this sounds
at all interesting.  "CNI" is the binding; it's much lighter weight
than JNI (which has been known to kill all performance advantages of
using native code due to its call overhead).  It's a goal to have C++
and Java code interwork as smoothly as C++ and C do.

A sample CNI interface is included below.

If you go to my XML page (http://home.pacbell.net/david-b/xml/) you'll
see everything is set up to work with GCJ.  To try it now, you should feel
comfortable compiling GCJ (compiler and runtime!) from source, have the
bandwidth to download ~15Mb source snapshots, and cope with the bugs.

For the record, when I've run GCJ it's been mostly faster than Sun's
JVM (including x86 JIT), but not always.  Yes, folk are hard at work
making this faster, and fixing the bugs.  (And as always, help is much
appreciated.)  GCC/EGCS 2.96 should be very interesting!!

- Dave


// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-

#ifndef __org_xml_sax_DocumentHandler__
#define __org_xml_sax_DocumentHandler__

#pragma interface

#include <java/lang/Object.h>
#include <gcj/array.h>

extern "Java"
{
  namespace org
  {
    namespace xml
    {
      namespace sax
      {
        class DocumentHandler;
        class AttributeList;
        class Locator;
      }
    }
  }
};

class ::org::xml::sax::DocumentHandler : public ::java::lang::Object
{
public:
  virtual void characters (jcharArray, jint, jint) = 0;
  virtual void endDocument () = 0;
  virtual void endElement (::java::lang::String *) = 0;
  virtual void ignorableWhitespace (jcharArray, jint, jint) = 0;
  virtual void processingInstruction (::java::lang::String *,
::java::lang::String *) = 0;
  virtual void setDocumentLocator (::org::xml::sax::Locator *) = 0;
  virtual void startDocument () = 0;
  virtual void startElement (::java::lang::String *,
::org::xml::sax::AttributeList *) = 0;
};

#endif /* __org_xml_sax_DocumentHandler__ */

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list