Sign in to follow this  
Followers 0
aommaster

Pointer variables

5 posts in this topic

Hi guys

Does Autoit support pointer variables, ie. variables that contain the memory location of other variables so that they can be used to pass arrays down to functions?

I looked at the PTR function, but that doesn't seem to be what I am looking for.

Thanks guys

Share this post


Link to post
Share on other sites



Hi

Sure it does.

Look at DllStructCreate, DllStructSet/GetData and DllStructGetPtr

Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

Awesome. Thanks everyone!

Share this post


Link to post
Share on other sites

Hi guys

Does Autoit support pointer variables, ie. variables that contain the memory location of other variables so that they can be used to pass arrays down to functions?

I looked at the PTR function, but that doesn't seem to be what I am looking for.

Thanks guys

Hi!

In autoit you cannot access variables by their addresses, it's still easy to pass arrays to functions.

Example:

Local $arr[10 ^ 6]
For $i = 0 To UBound($arr) - 1
    $arr[$i] = $i
Next

$timer=TimerInit()
SlowArray($arr)
ConsoleWrite("Calling without ByRef took: "&@TAB&TimerDiff($timer)&" ms."&@CRLF)

$timer=TimerInit()
FastArray($arr)
ConsoleWrite("Calling with ByRef took: "&@TAB&TimerDiff($timer)&" ms."&@CRLF)

Func FastArray(ByRef $arr)
    
    
EndFunc  ;==>FastArray

Func SlowArray($ArrCopy)
    
EndFunc  ;==>SlowArray

ByRef in this case could be looked at as a pointer.

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0