<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Greetings,<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:hedgehogshiatus@gmail.com">hedgehogshiatus@gmail.com</a> wrote:
<blockquote
cite="mid:fw5z5n6kkamoswbiviUYAxe124vaj_firegpg@mail.gmail.com"
type="cite"><br>
<br>
Hi Kent,
<br>
Thanks for the offer. Some questions follow.
<br>
The HLL discussion pages points to a PPT presentation on swig,
mentioning that the swig interface file could be distributed:
<br>
1) Are these swig interface files available?
<br>
2) How do they compare to permafrost's swig interface files, see
<a class="moz-txt-link-freetext" href="http://code.google.com/p/permafrost">http://code.google.com/p/permafrost</a>.
<br>
3) Anyother known sources of hdf5 swig interface files? Any considered
to be the reference interface definition?
<br>
</blockquote>
I wrote the Swig interface referred to here and then abandoned it after
the h5py package became available. My interface was very rudimentary
and rather specific to Python. I was trying to do a minimal amount of
work and let the SWIG do most of the work.<br>
<br>
A number of problems cropped up during its development.<br>
<br>
1) The use of macros in the C API of HDF5 causes problems because SWIG
cannot automatically analyze them. (I would like to see them removed
though I can't see how this can be done without an API change.) I got
around this by cheating, but the right way to to do is to write code to
wrap the macros by hand.<br>
<br>
2) Later versions SWIG became rather strict about not allowing python
to convert integers to pointers. The numpy module for Python can
provide a pointer to array memory as a Python integer. The HDF5 C API
wants void *, etc. and the Python SWIG wrapper reflects this. I
started a C conversion library which was nothing more than functions of
integers which cast the argument into a a pointer, eg:<br>
<br>
<blockquote><tt>void *Return_void (int NumPyInt) {</tt><br>
<br>
<tt> return (void *) NumPyInt;</tt><br>
<br>
<tt>}</tt><br>
<br>
</blockquote>
When wrapped by SWIG this provided the necessary type conversion
functions in Python. The opaque object returned to the Python
interpreter could be passed to the SWIG interface to HDF5.<br>
<br>
If you want to develop a Ruby interface I would recommend starting by
looking at Andrew Collette's excellent h5py interface. It was written
using a Python specific C interface so the code itself probably isn't
useful to Ruby, but it will give you a sense of the effort involved.
If you are familiar with Python you'll also see the nice way in which
h5py "shoe horns" the API and HDF5 objects into the syntactic
structures familiar to Python programmers. I imagine there are similar
opportunities in developing the Ruby interface.<br>
<br>
Cheers,<br>
--dan<br>
<br>
<pre class="moz-signature" cols="72">--
Daniel Kahn
Science Systems and Applications Inc.
301-867-2162
</pre>
</body>
</html>
----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.