GrungeRocker Posted January 7, 2009 Share Posted January 7, 2009 As said in the Topic, I want to make a DLL with C++ which should be used with AutoIt. Is there something special I have to mind? Did someone gain some experience? Anyone got Sourcecode (AutoIt & C++)? [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
monoceres Posted January 7, 2009 Share Posted January 7, 2009 Yeah I usually compile dll's in C++ and use them in AutoIt. Pretty nice when you need speed or multi-threading Here's an example: Fire up your C++ environment and start a new dll project then copy and paste this code and compile: extern "C" int __declspec(dllexport) TestFunc (int a) { return a*2; } You can then call the resulting dll in AutoIt like this: $call=DllCall("thenameofthedll.dll","int:cdecl","TestFunc","int",5) MsgBox(0,"5*2 is:",$call[0]) Good luck Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 7, 2009 Author Share Posted January 7, 2009 OK one more Question... I tried to make a simple class in my DLL but it did not work... How to do this? And how do you use it in AutoIt then? Is it possible? [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
monoceres Posted January 7, 2009 Share Posted January 7, 2009 (edited) OK one more Question...I tried to make a simple class in my DLL but it did not work...How to do this?And how do you use it in AutoIt then?Is it possible?You cannot interact with classes in autoit* so you need to abstract that away in your exported functions. If you need to pass classes between calls use pointers instead. * It's possible to call methods and such but it's not very nice and clean and is more job than just rethinking your logic in the dll. Edited January 8, 2009 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 8, 2009 Author Share Posted January 8, 2009 OK thx Good to know =) [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] 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