I'm having trouble calling a function in a c++ dll from delphi.
The c++ function is defined as following
BALL_SCRUB_DLL_API int CALLING_CONVENTION bsl2_ModelBallFlight(float cam_X,
float cam_Y,
float cam_Z,
Ball3d* ball_data_in,
int n_balls_in,
Ball3d* ball_data_out,
int &n_balls_out);
The ball struct looks as follows:
typedef struct
{ float X;
float Y;
float Z;
float VX;
float VY;
float VZ;
int frame_id;
int flag;
} Ball3d;
I want to send an array of ball_data_in from my delphi app and the c++ dll will return the same array type but with modified values in ball_data_out.
I have defined a TBall3D record as follows:
TBall3D = record
X : Single;
Y : Single;
Z : Single;
VX : Single;
VY : Single;
VZ : Single;
Framecount : Integer;
BallFlag : Integer;
end;
PBall3D = ^TBall3D;
TBall3DArray = array of TBall3D;
PBall3DArray = ^TBall3DArray;
My function declration looks as follows:
TBSL2_ModelBallFlight = function( const Cam_X, Cam_Y, Cam_Z : Single;
const ball_data_in : PBall3DArray;
const NFramesIn : Integer;
var ball_data_out : PBall3DArray;
const NFramesOut : Integer) : Integer; cdecl;
How do i make that call from delphi to the dll? Any help would be highly appreciated.