Jump to content

How to use DllCall with a function that returns a tuple

Go to solution Solved by Danp2,

Recommended Posts

I have a DLL which returns a tuple value (boolean, string).

I tried using the following:

$Result = DllCall("mydll.dll", "BOOLEAN:STR", "Check_if_running")

but I get back @error = 2 (unknown return type)

If I change the return type to just BOOLEAN, I then get @error = 3 (function not found in the DLL)

I'm trying to do this as I have written a program using the DLL in VB.Net, but I'm wondering if the same program in AutoIt would produce an exe which would have a smaller memory usage, as the program has to run 24 hours a day on machines with limited memory.



Back up my hard drive? - I can't even find reverse gear.

Link to comment
Share on other sites

Link to comment
Share on other sites

  • 3 weeks later...

Hi, sorry for the long delay - been away.


Anyway, still no success, so I wrote a simple function in my dll which just returns a string, but I'm still getting @error returned as 3 - "function not found in the DLL file".

I know the function is there, as I wrote the DLL in VB.net, so here's my autoit code...

Local $Returned = DllCall("c:\mydll.dll", "STR", "Test", "STR", "Test")
if @error <> 0 Then
    MsgBox(0, "Error", @error)
    MsgBox (0, "", $Returned[0])

And the dll function is this:

Public Function Test(strInput As String) As String

        Return "The input string was " & strInput

    End Function

The only thing I can think of is that the function is in a class inside the DLL, so if the class is called 'TestFunctions', how would I pass that in the DLLCall? - I've tried 

DllCall("c:\mydll.dll", "STR", "TestFunctions/Test", "STR", "Test")

DllCall("c:\mydll.dll", "STR", "TestFunctions\Test", "STR", "Test") 

DllCall("c:\mydll.dll", "STR", "TestFunctions:Test", "STR", "Test")

DllCall("c:\mydll.dll", "STR", "TestFunctions.Test", "STR", "Test") with no joy 😕


Back up my hard drive? - I can't even find reverse gear.

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

  • Recently Browsing   0 members

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