Jump to content

Recommended Posts

Posted

Hi all,

I read an example of creating a dll file in VC++ and was managed to get a compiled dll for a simple addition function.

Trying to run it with Autoit but instead of returning an array as in the documentation it's returning an int value 0.

Any help would be much appreciated.

Thanks in advance,

Ankit

[topic="80940"] AutoScript Creator, Script to automate anything![/topic]

Posted

Check the value of the @error macro right after you do the DllCall. The help file specifies what the error value means. Your dll could be malformed (is this the right term?).

That's the thing. The @error returns 0 which means it was successful! :)

[topic="80940"] AutoScript Creator, Script to automate anything![/topic]

Posted

That's the thing. The @error returns 0 which means it was successful! :)

@error being zero means that no errors occurred but that isn't the same as success.

What did you do in your dll to make it return an array? Did you return a pointer to the array?

Did you use stdcall?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

@error being zero means that no errors occurred but that isn't the same as success.

What did you do in your dll to make it return an array? Did you return a pointer to the array?

Did you use stdcall?

#include <windows.h>


BOOL WINAPI  DllMain (
            HANDLE    hModule,
            DWORD     dwFunction,
            LPVOID    lpNot)
{
    return TRUE;
}

/* Add two integers */
_declspec (dllexport) int __stdcall sum(int a, int b){
    return((int)(a+b));}

The above code is what I had in my adder.c dll.

[topic="80940"] AutoScript Creator, Script to automate anything![/topic]

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
×
×
  • Create New...