Pointer to an Array?

BlitzMax Forums/BlitzMax Beginners Area/Pointer to an Array?

Sorry, I'm having a bit of a brainfart here, because I've done this plenty of times. I want to pass the address of an array ( integers, not UDT's ) to a DLL, and I can't remember the syntax for doing it.

I've set the extern up to expect an Int Ptr, and then what do I pass to it?

I'm guessing VarPtr(MyArray[0]) but I'm not 100%.

Int Ptr(MyArray) should do it =)

EDIT: btw, if the array and the pointer are of the same type then MyArray is all you need.

Thanks Grable. All three seem to compile, but just MyArray alone is most readable, so I think I'll use that.

If it's an array of integers surely MyArray actually is the pointer to the first element, as an int pointer already?

ie don't need the Int Ptr() part?

That's what Grable says in his edit. ( Which was before I replied, so it must have been here when you replied. )

btw, if the array and the pointer are of the same type then MyArray is all you need.