|
|
| Author |
Message |
AnthonyCSheehy Active User

Joined: 04 May 2007
Posts: 7
|
Posted: Tue May 29, 2007 3:20 pm Post subject: integer sizes |
|
|
I am writing some .net 2.0 applications that query the PicoScope.
One thing I have noticed is the difference in stated integer sizes. For example the manual defines the time_interval pointer for ps3000_get_timebase as a long. However, it only returns a 32 bit integer.
If I try to fit a long (64bit) to stated long function parameters I often get a mismatch error between the managed and unmanaged code, or an attempt to write protected memory error.
As it goes, assigning a int64 to this value does not return an error, but the value returned does not go above 2147483648... which is 32 bits?
Would it be possible for someone to publish the correct byte sizes for the function definitions in the manual. |
|
| Back to top |
|
 |
markB Site Admin

Joined: 27 Mar 2007
Posts: 80
Location: Cambridgeshire,UK
|
Posted: Wed May 30, 2007 1:53 pm Post subject: |
|
|
Hi
A win32 long is only a 32 bit integer and is not equivilent to a managed Int64. You should use an Int32 for both win32 int and long.
Take a look at the "Calling Native Functions from Managed Code" topic of the msdn library, [url]http://msdn2.microsoft.com/en-us/library/ms235282(VS.80).aspx[/url], for more info. |
|
| Back to top |
|
 |
AnthonyCSheehy Active User

Joined: 04 May 2007
Posts: 7
|
Posted: Wed May 30, 2007 2:17 pm Post subject: |
|
|
Ah - thank you.
I think that the confusion is that I am writing in VB.net. (I suppose I should have mentioned that to make it clearer - my mistake.)
In VB, Long data type is, in fact, 64-bits. I guess that is what is confusing me.
Ah, yes I understand. The microsoft document includes a mapping between win32 types and the CLR type. Strange that the long and integer types are the same length. I wonder if that's a throwback to the 16 bit days...
Thanks |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|