I'm a process of 64 bit, my int
size is 8 bytes.
I'm referencing a dll which is compiled to 32 bit.
This dll has a function which accepts an int
parameter.
What will happen?
I'm sending a 8 byte
to a 4 byte
"container" ?
A 32 bit Signed Integer can house a number from −2,147,483,648 to 2,147,483,647 Unsigned: 0 to 4,294,967,295. A 64 bit Signed Integer can house a number from −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Unsigned: 0 to 18,446,744,073,709,551,615.
int is 32 bits in size. long , ptr , and off_t are all 64 bits (8 bytes) in size.
In 32-bit operating systems, the int type is usually 32 bits, or 4 bytes. Thus, the int type is equivalent to either the short int or the long int type, and the unsigned int type is equivalent to either the unsigned short or the unsigned long type, depending on the target environment.
32-bit means that a microprocessor can execute 4 bytes of data in one instruction cycle while 64-bit means that a microprocessor can execute 8 bytes of data in one instruction cycle. Since microprocessor needs to talk to other parts of computer to get and send data i.e. memory, data bus and video controller etc.
No, in 64-bit / C#, an int
is still 4 bytes.
In C#, int
is always merely an alias to global::System.Int32
What will change is the reference size and pointer size, but that is all abstracted by the IL anyway - nothing needs to change. Note, though, that the CLI is only going to be 32 bit xor (nand?) 64 bit. You might need one of them to be "Any CPU".
It always maps to System.Int32
hence would be needing only 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With