Re: Calling C api's for a hdf lib
Peter Haas <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.jedi |
|---|---|
| Message-ID | <[email protected]> |
Hi Gerhardus,
on 2004-01-27T09:11:40+01:00 you wrote:
> #define H5F_ACC_RDONLY (H5check(),0x0000u) /*absence of rdwr => rd-only
> */
> #define H5F_ACC_RDWR (H5check(),0x0001u) /*open for read and write */
> #define H5F_ACC_TRUNC (H5check(),0x0002u) /*overwrite existing files
> */
> #define H5F_ACC_EXCL (H5check(),0x0004u) /*fail if file already exists*/
> #define H5F_ACC_DEBUG (H5check(),0x0008u) /*print debug info */
> #define H5F_ACC_CREAT (H5check(),0x0010u) /*create non-existing files
> */
> function
> D_H5FCreate(name:pchar;flags:integer;createid,accessid:integer):integer;
> cdec
> l;external 'hdf5dll.dll' name 'H5Fcreate';
> I can call the function and it works well but I have no idea what the
> flags value should be.
...
> Must I in some way use this constants defined in the .h file or can
> I just use my own. I would presume using the predefined constancts
> would be best as that automatically calls the H5check function.
The simple case would be to use simple constants
const
H5F_ACC_RDONLY = $0000; // absence of rdwr => rd-only
H5F_ACC_RDWR = $0001; // open for read and write
H5F_ACC_TRUNC = $0002; // overwrite existing files
H5F_ACC_EXCL = $0004; // fail if file already exists
H5F_ACC_DEBUG = $0008; // print debug info
H5F_ACC_CREAT = $0010; // create non-existing files
and include the version check in your application, e.g. by call in the
initialization section:
const
// Version numbers
H5_VERS_MAJOR = 1; // For major interface/format changes
H5_VERS_MINOR = 6; // For minor interface/format changes
H5_VERS_RELEASE = 1; // For tweaks, bug-fixes, or development
H5_VERS_SUBRELEASE = ''; // For pre-releases like snap0
// Empty string for real releases.
H5_VERS_INFO = 'HDF5 library version: 1.6.1'; // Full version string
procedure H5check;
begin
H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
end;
initialization
H5check;
end.
To build a check similar to C sources, you need to use functions:
interface
function H5F_ACC_RDONLY: Cardinal; // absence of rdwr => rd-only
function H5F_ACC_RDWR: Cardinal; // open for read and write
function H5F_ACC_TRUNC: Cardinal; // overwrite existing files
function H5F_ACC_EXCL: Cardinal; // fail if file already exists
function H5F_ACC_DEBUG: Cardinal; // print debug info
function H5F_ACC_CREAT: Cardinal; // create non-existing files
implementation
function H5F_ACC_RDONLY: Cardinal;
begin
H5check;
Result := $0000;
end;
function H5F_ACC_RDWR: Cardinal;
begin
H5check;
Result := $0001;
end;
function H5F_ACC_TRUNC: Cardinal;
begin
H5check;
Result := $0002;
end;
function H5F_ACC_EXCL: Cardinal;
begin
H5check;
Result := $0004;
end;
function H5F_ACC_DEBUG: Cardinal;
begin
H5check;
Result := $0008;
end;
function H5F_ACC_CREAT: Cardinal;
begin
H5check;
Result := $0010;
end;
I hope this help you.
BTW: Do you want to publish your header conversion? JEDI+ API is a
active project, which support header conversions. JEDI+ API have a
list with links to different conversions and create and maintain own
conversions: http://jediplus.pjh2.de/api If you want to use this
possibility, write me a private mail.
I write this, because JEDI Tech is a dead project and unfortunately
JEDI Steering don't want to continue it active, even if it create a
new fassade, there is nothing behind.
Bye Peter.
--
"It is not our job to work on new conversions or update older ones."
Robert Marquardt (Team JEDI) in <[email protected]> without any
contradiction from the JEDI Steering Team.
Visit the active JEDI API Conversion Project: http://jediplus.pjh2.de/
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/Delphi-JEDI/
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/