Sign in to follow this  
Followers 0
AZJIO

How to return an array from a DLL?

9 posts in this topic

#1 ·  Posted (edited)

I want from the script (au3) call the function from the DLL. The function in the DLL returns an array. Can AutoIt get an array?

the only way?

$a = DllStructCreate("int[120]")
Edited by AZJIO

Share this post


Link to post
Share on other sites



Array of what, integers? Do you mean pointer to array of integers?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

If to be exact, float is necessary. I think to change the size not a problem.

Share this post


Link to post
Share on other sites

Do you mean exported dll function will return array of floats?

You have to be precise about what you want or have.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I've wondered about this.

In order for a dll to fill an array passed by autoit, I fear you might need to know the variant type of an autoit array, and moreover that type might have to be supported as a passable value in DllCall.

I think Struct pointer might be the only way, and be sure also to pass it's size.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

I think that the array (AutoIt3) is an array of pointers. So will have to use the structure. DLL returns the size of the unknown in advance. I need to get a pointer to a structure? I need to set up data exchange between the script and DLL.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Perhaps, but knowing they are pointers is not enough, In C++ you need to know what type of data a pointer points to.

And we are full circle.

I'm sure you know about DllStructGetPointer and DllStructGetSize.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Since this doesn't seem to be going anywhere fast, I'll speed it up by asking for the dll's function definition.

Share this post


Link to post
Share on other sites

Hopefully something like:

int myFunction(int* ret, size_t retLen);

We can only hope.

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