Porting HDF5 to Delphi

Hi,

I am trying to port HDF5 to delphi.
The main hindrance are functions that return char * in hdf5dll.dll
After all it is impossible to free that string without access violation, for
example:
member_name := H5Tget_member_name(mem_type_id, i);
FreeMemory(member_name ); //Access violation here

I have avoided that situation compiling hdf5dll with additional function:

adding in
h5public.h

H5_DLL herr_t H5FreeMem(char * memToFree);

adding in
H5.c

herr_t
H5FreeMem(char * memToFree)
{
FUNC_ENTER_API_NOINIT_NOERR_NOFS
H5TRACE0("e","");
free(memToFree);
FUNC_LEAVE_API_NOFS(SUCCEED)
} /* end H5FreeMem() */

If there is no similar functionality (may be I dont know where it is
hiding), it woud be nice to have this enhancement in future version of HDF5.

Regards,
Saulius

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Porting-HDF5-to-Delphi-tp4025566.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Anyone who is interested in HDF5 Delphi, can download converted API and free
open source demo program from my site:
http://www.astro.ff.vu.lt/index.php?option=com_content&task=view&id=46&Itemid=63

Tested under Windows 7, 64bit OS and Windows Virtual PC XP mode.

exe compiled with Embarcadero RAD studio Delphi XE2 edition, 32 bit
application

dll compiled with Visual studio 2010. 32 bit application.

version 1.8.10. Name: hdf5dll_m.dll (m stands for "modified")
No need for msvcr100.dll and msvcp100.dll
zlib.dll and szip.dll (if needed) must be used from original HDF5 software
http://www.hdfgroup.org/downloads/index.html

Modifications (to compare with original versions hdf5dll.dll):

Introduced free memory for functions, returning * char
in:
H5public.h

H5_DLL herr_t H5free_mem(char * memToFree);

in:
H5.c

herr_t
H5free_mem(char * memToFree)
{
    herr_t ret_value = SUCCEED;

    FUNC_ENTER_API(FAIL)
    H5TRACE0("e","");

    /* Free memory */
    free(memToFree);

done:
    FUNC_LEAVE_API(ret_value)
}

Best regards,

Saulius

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Porting-HDF5-to-Delphi-tp4025566p4025589.html
Sent from the hdf-forum mailing list archive at Nabble.com.