Maybe you should try to define distCameraToSubject at the beginning of the code.
This works for me:
#include "windows.h"
#include "DarkSDK.h"
#include "stdio.h"
void DarkSDK ( void )
{
float time;
char text[256];
float distCameraToSubject = 0.0f;
dbSyncOn();
dbSyncRate(90);
dbMakeVector3 (1);
dbMakeObjectBox(1,100,100,100);
dbPositionCamera(1, 0,0,100);
time=dbTimer();
for (int i=0 ; i<500;i++)
{
dbPositionObject(1, 0,0,i);
dbSetVector3 ( 1 , dbCameraPositionX( 0 ) - dbObjectPositionX( 1 ),
dbCameraPositionY( 0 ) - dbObjectPositionY( 1 ),
dbCameraPositionZ( 0 ) - dbObjectPositionZ( 1 ) );
distCameraToSubject = dbLengthVector3( 1 );
sprintf(text, "distCameraToSubject = %f", distCameraToSubject);
dbText(10, 10, text);
dbSync();
}
time=dbTimer()-time;
dbCLS();
sprintf(text, "distCameraToSubject = %f", distCameraToSubject);
dbText(10, 10, text);
sprintf(text, "time = %f", time);
dbText(10, 50, text);
dbSync();
dbSuspendForKey();
}
Although, shouldn't the end distance equal to 400 (500-100)? Uh.