Jump to content

Recommended Posts

Posted

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]

Posted

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 :o

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

Posted

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]

Posted (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 by monoceres

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...