Jump to content

C Return Type


Recommended Posts

Yes, it throws an error and returns 0. It's named $aReturn for a reason ;). I also have the $aReturn[0] later in my code, which is why the error is thrown, because [0] doesn't exist.

Edit: I believe that it's not working because of a problem with the return type. My other parameters are correct and I'm accessing it correctly later in the script (as an array, that is).

Edited by darkjohn20
Link to comment
Share on other sites

Show your code that works.

My code doesn't work. I'm trying to figure out why.

All I was stating before was that I have everything set up correctly, it's just the DLL Call that isn't working out.

The two parameters have the correct values, and the function name is right.

I'm accessing it correctly later in the script (as an array, that is).

Meaning that I'm using $aReturn[0] later in my code. The problem is that the DLL call is failing.

My full function is:

Func _GetClientAddressTCP($iInstance, $iClientID)
    Local $aReturn = DllCall($hDLL, "str:cdecl", "GetClientAddressTCP", "ulong_ptr", $iInstance, "ulong_ptr", $iClientID)
    Return $aReturn[0]
EndFunc

And yes, the DLL is defined AND opened.

Edited by darkjohn20
Link to comment
Share on other sites

Hi, what DLL is it?

Try adding error check after the DllCall before even trying to return $aReturn[0]

When it's failing the call is it AutoIt DllCall failing?

eg: @error 1, 2 , 3, 4

Or maybe your meaning that AutoIt DllCall doesn't fail but the call is failing from the dll itself.

Without knowing the proper info about the dll and the data and method of the call then it makes it hard to say where and why your call is failing.

Your posting little info and wanting people to fill in the big picture with guesses and assumptions.

Edit, My guess is that your using a dll from MikeNet aka DarkNet?

Edited by smashly
Link to comment
Share on other sites

Well, the error code is 3, so I guess the function doesn't exist. I'll review the source code to see if it's under a different name.

I also realize that I'm leaving a big gap. At first I figured that NetAddress was the problem, and I also figured that that was a well known Class or whatever you want to call it.

About 5 minutes after I posted I realized that it wasn't, which would be confusing to anybody reading the topic.

I'll look through the code to see if I can locate the problem. I'll come back when I figure out what is going on.

Thanks for your time and sorry for the confusion.

Link to comment
Share on other sites

Hi, what DLL is it?

Try adding error check after the DllCall before even trying to return $aReturn[0]

When it's failing the call is it AutoIt DllCall failing?

eg: @error 1, 2 , 3, 4

Or maybe your meaning that AutoIt DllCall doesn't fail but the call is failing from the dll itself.

Without knowing the proper info about the dll and the data and method of the call then it makes it hard to say where and why your call is failing.

Your posting little info and wanting people to fill in the big picture with guesses and assumptions.

Edit, My guess is that your using a dll from MikeNet aka DarkNet?

Yes, I am. Since Mike is a friend of mine I'm asking him about the situation.

This is the function I'm trying to use, and my guess is it isn't in the "Normal DLL", or it's under an extended name.

Edit: AHH. It appears that there is also the command GetClientIPTCP. That's exactly what I need.

Problem is most likely solved, because I seem to remember that command from version 1. ;)

I feel kind of stupid now. That command was there the whole time, but I didn't find it somehow.

Edited by darkjohn20
Link to comment
Share on other sites

You can't call a constructor with DllCall. It doesn't work that way.

Thanks for informing me. I honestly don't have any idea what a constructor is, I was just wondering if it would be of any help. I found the right command so the original question(s) don't need to be answered.

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...