Sign in to follow this  
Followers 0
jtwspoon

dllcall

13 posts in this topic

I am trying to use dllcall  to pass a variable to a dll that modifies the value of that variable.  But the variable does not appear to get modified as it should.  The relevant code is attached.  Any help or suggestions would be appreciated.  Thanks.

test.au3

GSLINK.ZIP

Share this post


Link to post
Share on other sites



the dll?

Saludos


 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
Share on other sites

Do something like this:

locaL $get=10
Local $ret=DllCall("gslink.dll","none","gsupdate","int*",$get)
$get=$ret[1]
MsgBox(0,"",$get)

use stdcall

procedure gsupdate(var y: integer);  stdcall;

Saludos


 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
Share on other sites

Ok, I know I can do it that way, but  I want to eventually do something more substantial --- namely  altering the elements of an array passed to the dll.  Are the changed values always going to have to be accessed as elements of the $ret array, as in the example you posted, and NOT from the original array as passed to the dll?

Share this post


Link to post
Share on other sites

I think maybe using dllstructure. to fill the structure. 

Saludos


 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
Share on other sites

Yes, but still have to get the changed varaibles from $ret array?  Also, I notice that if I try to write to a file in the dll, then return back to autoit is corrupted so that autoit fails to continue, and morevover nothing ever gets written to the file, so I am unsure exactly what is getting corrupted and how.

Share this post


Link to post
Share on other sites

I mean something like this:

local $t=dllstructurecreate("long mylong")

dllcall("midll","none","mifuntion","ptr",dllstructuregetptr($t))

msgbox(0,"",$t.mylong)

Saludos

 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
Share on other sites

wouldn't you have to use dllstructgetdatarather than simply $t.mylong?

Share this post


Link to post
Share on other sites

not need to use dllstructgetdata just use dot(.) Access Saludos


 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
Share on other sites

Now I have my dll working correctly as called from autoit via DllCall, however if I attempt to write to a file from within my dll,  there is no  return to autoit from my dll.  What could be causing this?  I am sure there is no error in the code which writes to the file, and no path not found problem or anything of that sort. My Dll is written in Free Pascal, and I am running under Windows 7.

Share this post


Link to post
Share on other sites

Also,  if I run my dll as a stand-alone program, calculations differ from when I  run it as a dll.  In particular, some elements of a multidimensional array are not computed at all when run as a dll, while they are computed when run as a stand-alone program.  I tend to infer that  code within the dll gets corrupted when run as a dll from autoit.  Not sure what further tests I can try to resolve this problem.

Share this post


Link to post
Share on other sites

Previous post is incorrect. No problem with that after all.  Still have problem with writing to file in dll.

Share this post


Link to post
Share on other sites

Show us your code you have so far.


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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