How to pass array parameter to dllcall? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Hobby77
Posts: 30
Joined: 25 Jan 2021, 01:27

How to pass array parameter to dllcall?

Post by Hobby77 » 28 May 2023, 02:25

this is a dll function from C program:

Code: Select all

__declspec(dllexport) int normqsp(double* values)
this is my script:

Code: Select all

   values:= [0.12 , 2.12 , 3.12]

   valuesP := Buffer(8 * values.Length,0)
   loop values.Length 
         NumPut("Double", values[A_Index],valuesP,8*(A_Index-1))

   DllCall("Project1.dll\normqsp","ptr",valuesP,"Int")
It seems to get stuck while running the dllcall and the cpu spike is high, am I doing something wrong?

just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to pass array parameter to dllcall?

Post by just me » 28 May 2023, 06:10

Does the function expect a fix number of values?

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to pass array parameter to dllcall?  Topic is solved

Post by swagfag » 28 May 2023, 07:05

the ahk code checks out. the problem is in ur C function

Post Reply

Return to “Ask for Help (v2)”