Re: [xml] Delphi bindings for libxml2



Hi,

Eric Zurcher csiro au wrote:

In repsonse to Kasimier's queries:


This is good to hear! Will the bindings be Kylix compatible as well?


The bindings ought to work with Kylix, but I have tested them using only a
very simple example. I do not intend to support Pascal compilers other than
Delphi/Kylix, but if someone else wishes to take up that challenge, they are of course welcome to do so, with my blessing.

Very good!

Will it follow the namings used in Libxml2-pas? E.g. the "PxmlChar"?


There are some differences, but these could be changed fairly readily
if compatibility is important. The differences include: (1) Use of enumerated types with assigned ordinal values, rather that the use of constant integers, for "enum" values. (2) Use of the libxml2 convention of naming pointer types by appending "Ptr" (e.g., xmlCharPtr), rather than the

OK, we could change PxmlChar on our side, since we don't use the
bindings directly but through DOM wrappers. But I don't know how all the
other people using the old bindings will react. Hmm, looking up the
bindings I can see only PxmlChar diverting from the Libxml2 names.

Delphi convention of prepending a "P" (e.g., PxmlChar). Exceptions are
those types pre-defined by Delphi (e.g. PPChar, PDouble).


By the way, we realized that mapping the memory functions to use the
Delphi memory-manager in the initialization part of the libxml2.pas
unit is not adviseable, since if using DLLs every DLLs will overwrite
the previous mapping, resulting in the function pointers being invalid
for all DLLs when the last DLL which mapped is unloaded.


Yes, that is not a good approach when using DLLs, and I don't use it. Instead, I use a bit of indirection to make use of the xmlMalloc, xmlFree, etc., exported by the libxml2 DLL.

Yes, xmlMemGet and xmlMemSetup help here a lot.


I should mention that there are a few quirks relating to imported variables, since Object Pascal does not formally support importing of variables from shared libraries. However, it is possible to use addresses obtained from GetProcAddress to gain access to these variables.

I'm happy that finaly somebody cares for the Delphi/Kylix bindings
again!

Regards,

Kasimier



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