perhaps you could try to pass it over the boundary as double and cast it back to float on the C side.
Well I tryed it like this:
C#
public void SetVelocity(float lonRoadVelocity,float latRoadVelocity){Sim.Dll_Wheel_SetVelocity(this.nativeWheelObject,lonRoadVelocity,latRoadVelocity);}
C++
EXPORT_API void Dll_Wheel_SetVelocity(CarWheel* wheel,double lonRoadVelocity,double latRoadVelocity){ wheel->SetVelocity((float)lonRoadVelocity,(float)latRoadVelocity);}
And the result was, that nothing was transfered... the values stayed 0.
And about the question, to be specific I'm not using C, I'm using C++ (the languages should be different)
And currently I'm passing them the way as you described.
Also after some deeper debuging I found out that strangely the difference happens in my wheel class...
void CarWheel::SetVelocity(float lonVel,float latVel)
{
lonRoadVelocity = lonVel;
latRoadVelocity = latVel;
}
"lonRoadVelocity = lonVel" is actually "lonRoadVelocity != lonVel"
So its internal??? C++ float mismatched with C++ float? I'm confused....
Edit:
The above "internal" was a false alarm I guess.
Because I removed the "SetVelocity" method and pass the values directly, wheel->lonRoadVelocity = lonRoadVelocity;
and there still is difference, I think I was just confused,
Debug Results:
latRoadVelocity -0.15862428 float
lonRoadVelocity -0.036250707 float
+ wheel 0x1b75e120 {brake={...} tire={...} suspension={...} ...} CarWheel *
wheel->latRoadVelocity -0.15102120 float
wheel->lonRoadVelocity -0.036250707 float
After /arch:SSE2 and /fp:fast the difference actually is notably smaller. In this case for some reason it only occurs in "latRoadVelocity".
"lonRoadVelocity" seems to be 1:1 o nevery frame I debuged, so I'm getting closer