putting c++ into delphi

Posted on 2003-03-25
Medium Priority
Last Modified: 2010-04-04
I have this line in a C++ library :
where PKSPROPERTY is a pointer type to a Record type, and x is an integer.

I'm interested in making that C++ macro, a Delphi function.
Could someone give me a hand?
The thing is I do not know for sure what's the CAST PKSPROPERTY returning... Probably the instance, or handle, or pointer memory address.

Question by:5pn
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
LVL 11

Accepted Solution

robert_marquardt earned 100 total points
ID: 8208674
x is typecasted to a PKSPROPERTY which seems to be a pointer to a record.
 + 1 to a typed pointer in C (this is C not C++) gives the pointer to the next record.

  Result := PKSPROPERTY(Cardinal(X) + SizeOf(KSPROPERTY));

Maybe the function is more convienient if Pointer is used instead of PKSPROPERTY. This depends on the intended usage.

Author Comment

ID: 8220004
I eventually ended up with a similar thing.
Result:=Ptr (Cardinal(X) + 24) where 24 is the number of bytes occupied by KSPROPERTY.
Not sure 100% of your code, but still... it's a great thing to have another idea.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

765 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