A call to PInvoke function CopyMemory; has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
here is my code
Private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (ByRef Destination As Object, ByRef Source As Object, ByVal numbytes As Long)
Public Function BytesToDouble(ByVal TheArray() As Byte) As Double
'This function combines array of 8 bytes to a Double number - Format Little Endian
Dim TempLong As Double
Call CopyMemory(TempLong, TheArray(LBound(TheArray)), 8)
BytesToDouble = TempLong
End Function