[gdome]Re: translation gdome.h to pascal



Hello,

thanks a lot for the quick answer of my last question. Now I have the
next problem:

I created a unit gdome.pas from the gdome.h file.
I wrote the following test-program:

var domimpl: PGdomeDOMImplementation;
    doc: PGdomeDocument;
    exc:GdomeException;
    name: PGdomeDOMString;
begin 
  domimpl:=gdome_di_mkref; // create a domreference
  // I create a new document with TEST as root element
  name:=gdome_str_mkref (pchar('TEST'));
  doc := gdome_di_createDocument(domimpl, NIL, name, NIL, @exc);
  gdome_str_unref(name);
  gdome_di_freeDoc (domimpl, doc, @exc);
  gdome_di_unref(domimpl, @exc); // free the dom reference
end.

If fails in the line doc:=...
The error message:
Access violation at address 610583D2 in module cygwin1.dll. Read of
address 00000010.

I used the following declarations:

     gchar = char;
     Pgchar=pchar;      //could this be wrong?
     gshort = smallint;
     glong = longint;
     gint = longint;
     gboolean = gint;
     gstring = Pgchar;
     guchar = byte;
     gushort = word;

     gpointer = pointer;

     GdomeException = word;
     PGdomeException = ^GdomeException;

     PGdomeDOMString = ^GdomeDOMString;
     GdomeDOMString = record
          str : Pgchar;
          refcnt : gint;
          unref : procedure (self:PGdomeDOMString);cdecl;
     end;

     PGdomeDocumentVtab = pointer;
     PGdomeDocument = ^GdomeDocument;
     GdomeDocument = record
       vtab : PGdomeDocumentVtab;   // deprecated
       user_data : gpointer;
     end;

     PGdomeDOMImplementationVtab= pointer;
     PGdomeDOMImplementation = ^GdomeDOMImplementation;
     GdomeDOMImplementation = record
       vtab : PGdomeDOMImplementationVtab;  // deprecated
       user_data : gpointer;
     end;

 function gdome_di_createDocumentType(self:PGdomeDOMImplementation;
qualifiedName:PGdomeDOMString; publicId:PGdomeDOMString;
systemId:PGdomeDOMString;
exc:PGdomeException):PGdomeDocumentType;cdecl;external libgdome;

Any idea?

Uwe Fechner
ufechner 4commerce de





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]