brunomusw Posted May 14, 2009 Share Posted May 14, 2009 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 Link to comment Share on other sites More sharing options...
Authenticity Posted May 14, 2009 Share Posted May 14, 2009 Can you post some function definition and how you call it from AutoIt? Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 15, 2009 Share Posted May 15, 2009 You are using the wrong calling convention. Try adding ":cdecl" on the end of the return type, like "int:cdelc". See if that helps. Link to comment Share on other sites More sharing options...
brunomusw Posted May 15, 2009 Author Share Posted May 15, 2009 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 Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 15, 2009 Share Posted May 15, 2009 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? Link to comment Share on other sites More sharing options...
brunomusw Posted May 15, 2009 Author Share Posted May 15, 2009 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 Link to comment Share on other sites More sharing options...
monoceres Posted May 15, 2009 Share Posted May 15, 2009 You forgot to post your autoit code. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
brunomusw Posted May 18, 2009 Author Share Posted May 18, 2009 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 Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 18, 2009 Share Posted May 18, 2009 That should be DllCall($dll, ...) Link to comment Share on other sites More sharing options...
monoceres Posted May 25, 2009 Share Posted May 25, 2009 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now