07-28-2009 01:47 AM
I am using Call Library Function Node to call some dll routines that take handles and pointers as some of the function parameters. The operating system is Windows XP, and both the handles and pointers in the dll are 4 bytes long. When I set up the parameters in the Call Library Function Node, the handles and pointers were both passed as unsigned pointer sized integers that are passed by value. This seems to be working (so far), but when controls and indicators were created by right clicking on the inputs and outputs of the Call Library Function Node, the data type that was automatically created was U64, not U32. I would like to know why this is the datatype that was created (aren't pointers 32 bits?)? Do I need to use a different data type for the parameters (such as U32) to avoid problems with passing parameters to the dll? It seems to be working so far, but could problems occur if different pointer values occur than have happened so far?
Thanks in advance.
07-28-2009 10:06 AM
cbfsystems wrote:(aren't pointers 32 bits?)?
Not any more. Or at least, not necessarily. A pointer is a memory address. Thus, on 64-bit systems, you need a 64-bit value in order to address all of the available memory.
As for feeding a 64-bit value into a CLF that has a parameter that's specified as a 32-bit value you will get a coercion dot. Given that you're going from 64-bits to 32-bits, if the 64-bit value fits in 32-bits then there's no issue. If not, then your value gets chopped and the DLL would receive the wrong number. The other way (on the output going from 32-bit to 64 bits) is no real issue (other than the forced coercion).