Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Converting C header files to Delphi

I am a Delphi programmer (I don't know much about C) and I'm trying to write a program that works with a finger print reader that uses the bioapi (www.bioapi.org) interface specification.  As such, I have to convert the bioapi C include header files to Delphi (unless someone knows an easier way to do this)...and I need some help.

Here's an example that I need help converting (this is from the bioapi_type.h file).  I know the union statement converts to a Delphi case statement by I'm not sure how to structure it.

typedef struct bioapi_candidate
{
      BioAPI_IDENTIFY_POPULATION_TYPE Type;
      union
      {
            BioAPI_UUID_PTR BIRInDataBase;
            uint32 *BIRInArray;
      } BIR;
      BioAPI_FAR FARAchieved;
      BioAPI_FRR FRRAchieved;
} BioAPI_CANDIDATE, *BioAPI_CANDIDATE_PTR;
0
rwcochran
Asked:
rwcochran
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Russell LibbySoftware Engineer, Advisory Commented:

Need to fix the 2 types BioAPI_UUID_PTR and BioAPI_FAR (not enough info given to determine what they are supposed to be), other than that, the rest should be correct.

// Need the correct declarations for the following 2 types
type
  BioAPI_UUID_PTR   =  Pointer;
  BioAPI_FAR        =  Pointer;

type
  BioAPI_IDENTIFY_POPULATION_TYPE  =  packed record
     case Integer of
        0  :  (BIRInDataBase:   BioAPI_UUID_PTR);
        1  :  (BIRInArray:      ^LongWord);
  end;

type
  bioapi_candidate  =  packed record
     _Type:         BioAPI_IDENTIFY_POPULATION_TYPE;
     FARAchieved:   BioAPI_FAR;
     FRRAchieved:   BioAPI_FAR;
  end;
  TBioApiCandidate  =  bioapi_candidate;
  PBioApiCandidate  =  ^TBioApiCandidate;

Regards,
Russell
0
 
DragonSlayerCommented:
as expected, that is juz too easy for Russell ;-)
0
 
shaneholmesCommented:
This may also help!

http://delphi-jedi.org/team_darth_home

Shane
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Russell LibbySoftware Engineer, Advisory Commented:
Nice job on the points DragonSlayer ;-)  and a C grade to boot

lmao,
Russell
0
 
rwcochranAuthor Commented:
Many thanks to rllibby for the help.  I noticed I messed up and hit the wrong Accept button and didn't give you the credit (sorry, I just signed up on the site and I'm still getting used to the procedures).  Please forgive the mistake.  I'm sure I'll have more questions and I promise not to make that mistake again.
0
 
Russell LibbySoftware Engineer, Advisory Commented:
The points are not big deal (truly), but watch the "C" grade.... Do it too many times, and there won't be anyone willing to touch your questions.

Kind Regards,
Russell
0
 
rwcochranAuthor Commented:
Sorry about the "C" grade DragonSlayer...just a newby mistake...it won't happen again.  By the way, is there anyway to correct it?
0
 
DragonSlayerCommented:
Post a message at Community Support, asking them to reopen this question and award the points to Russell instead.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now