Sign in to follow this  
Followers 0
brunomusw

Dll and Autoit

10 posts in this topic

Hi...

I create a DLL in C, on my DLL I'm acessing the windows DLL.

I'm having problem when I pass a parameter to the DLL's function, the functions executes but after finished, the Autoit crashes.

But when I execute the same function without passing parameters (the parameters are already on the DLL) the Autoit runs ok.

Any thoughts?

Brunomusw

Share this post


Link to post
Share on other sites



Can you post some function definition and how you call it from AutoIt?

Share this post


Link to post
Share on other sites

You are using the wrong calling convention. Try adding ":cdecl" on the end of the return type, like "int:cdelc". See if that helps.

Share this post


Link to post
Share on other sites

You are using the wrong calling convention. Try adding ":cdecl" on the end of the return type, like "int:cdelc". See if that helps.

Richard thanks for the ideia, it didn't work but I could find the way.

The cdecl didn't work because I was calling a function on Win32 so I use the _stdcall. So the call function on C stays:

__declspec(dllexport) int _stdcall SF_Beep(DWORD par1, DWORD par2);

Thanks...

Brunomusw

Share this post


Link to post
Share on other sites

Well, the crash sounded like a problem with the calling convention. It may also be that you are using the wrong parameter types. May I see the AutoIt DllCall you wrote?

Share this post


Link to post
Share on other sites

Well, the crash sounded like a problem with the calling convention. It may also be that you are using the wrong parameter types. May I see the AutoIt DllCall you wrote?

Richard, It worked with the _stdcall and the function stay like I said:

CODE
__declspec(dllexport) int _stdcall SF_Beep(DWORD par1, DWORD par2);

regards,

Brunomusw

Share this post


Link to post
Share on other sites

You forgot to post your autoit code.


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

Share this post


Link to post
Share on other sites

You forgot to post your autoit code.

The autoit function.

Func ConfigRTSDTR( $rts,$dtr )
 $dll = DllOpen("SerialFuncs.dll")
 $ret = DllCall("SerialFuncs.dll", "int", "ConfigRTSDTR","dword",$rts,"dword",$dtr)
EndFunc

Brunomusw

Share this post


Link to post
Share on other sites

That should be DllCall($dll, ...)

Share this post


Link to post
Share on other sites

That should be DllCall($dll, ...)

Shouldn't matter though.

@OP, you're trying to call ConfigRTSDTR when you posted the declaration for SF_Beep(). ANy thoughts on that?


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