Jump to content

Make a c++ dll callable in autoit


 Share

Recommended Posts

Hi,

I'm trying to create a simple dll which I can call from autoit.

After some search I got a simple printf working, but when I try to add some parameters it crashes.

#include "stdafx.h"
#include <iostream>

using namespace std;

extern "C"
{
    __declspec(dllexport) void Multiply(int a, int b) {
        printf("Hello from DLL ! %d\n", a);
        //return a*b;
    }
}
$a = DllCall("MyDLL.dll", "none", "Multiply") ;, "int", 4, "int", 5)

ConsoleWrite("error: " & @error & @Lf)
If IsArray($a) = 1 Then ConsoleWrite($a[0] & @Lf)

Any help will be appreciated.

Br, FireFox.

Link to comment
Share on other sites

You need to use cdecl.

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

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