?
Solved

C Conversion

Posted on 2005-04-01
6
Medium Priority
?
182 Views
Last Modified: 2010-04-05
Is this correct?

I want to verify that I am converting the "struct SDBAttributeList_t FAR *keyList;" correctly

typedef struct SDBAttributeList_t {
    _Int             count;
    SDBAttrHdr_t    FAR *sdbAttrHdr;
} SDBAttributeList_t;

type PSDBAttributeList_t = ^SDBAttributeList_t;
    SDBAttributeList_t   = record
    count : _Int;
    sdbAttrHdr : PSDBAttrHdr_t ;
end;


typedef struct SDBDeleteObject_t {
    SDBConnectionID_t connID;
    SDBFileType_t   fileType;
    struct SDBAttributeList_t FAR *keyList;
} SDBDeleteObject_t;


type  SDBDeleteObject_t = record
  connID: SDBConnectionID_t;
  fileType: SDBFileType_t;
  keyList: PSDBAttributeList_t;  //IS THIS CORRECT?
end;
0
Comment
Question by:rbohac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 200 total points
ID: 13681177
Yes, that is correct. The "FAR *" on the structure is the same as delphi's

PRecordType = ^RecordType

where

RecordType  = (packed) record
 ...
end;


Regards,
Russell
0
 
LVL 16

Expert Comment

by:CodedK
ID: 13682211
I think ur code will work as it is for Delphi 2005 but for Delphi 7 i agree with rllibby.
You may have to get rid of packed.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 13682536
In truth, it all depends on what your converting / integrating with (packed record types are pretty much the norm nowadays.) If the record structure is in multiples of 4 (hard to tell with the missing decls above), then it will be a moot point, eg:

type
 TFoo1 = packed record
   f1:    Integer;
   f2:    Pointer;
 end;

type
 TFoo2 = record
   f1:    Integer;
   f2:    Pointer;
 end;

SizeOf(TFoo1) = SizeOf(TFoo2)

---------
Russell
0
Technology Partners: 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!

 
LVL 6

Author Comment

by:rbohac
ID: 13683382
I have {$A8} set because of a line above it : #pragma pack(8)

How does this effect this?
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 13683456

Your alignment should be fine as you have them declared. In this situation you would NOT use the packed statement on the record structs, as then they would become the same as

#pragma pack(1) /* the norm */

Russell

0
 
LVL 6

Author Comment

by:rbohac
ID: 13683600
Awesome. Thanks again!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question