Synchronized value between C # and C ++?

Is there a function that exists in both C # and (unmanaged) C ++ that returns a synchronized number (like a float or int)?

For example, is there something that brings the exact system time, at least for the second, that will return the same result in both C ++ and C # being called at the same time?

Just wondering = =

0


a source to share


3 answers


Are you talking about managed C ++ (C ++ / CLI) or native C ++ here? If you are using managed code all over the place, then the obvious solution is to use a property Environment.TickCount

. In native C ++, the equivalent is a Win32 API function GetTickCount

.



+2


a source


A better choice for complete control over your control might be to use p / invoke to call a Win32 function, such as GetSystemTime or GetTickCount, directly from C #.



But underneath that all DateTime is just calling Win32 functions, so there is no reason it would give you significantly different realtime time than you would use regular C-style Win32 calls.

+1


a source


Managed C ++ and C # most likely. Unmanaged C ++ maybe not, as it doesn't compile to IL.

0


a source







All Articles